cancel
Showing results for 
Search instead for 
Did you mean: 

Binding the expand entity to smart table

VenkateshThota
Explorer
0 Kudos

Hello Friends

can anyone help with binding the Expand entity to smart table

View and Controller Code

<smartTable:SmartTable id="smartIdid" entitySet="" tableType="ResponsiveTable" useExportToExcel="true" useTablePersonalisation="true" showRowCount="true" showFullScreenButton="false" enableAutoBinding="true" showVariantManagement="true" width="100%" header="Price Book Operations" beforeRebindTable="onBeforeRebindTable" > <Table id="dataTable" selectionChange="onSelectItem1" sticky="ColumnHeaders,HeaderToolbar"> <columns> <Column> <customData> <core:CustomData key="p13nData" value='{"columnKey": "ValuesSet","leadingProperty": "ValuesSet"}'/> </customData> <Text text="Product Id"/> </Column> </columns> <items> <ColumnListItem type="Navigation" press="onSelectPriceGroup"> <cells > <Text text="{ValuesSet/name}"/> <!--<Link text="{position}" press="onpresspbno"/>--> </cells> </ColumnListItem> </items> </Table> </smartTable:SmartTable>

Controller Code

onAfterRendering:function(){

this.Path="TableSet?$filter=tablename eq 'Mara'"; //main entity in the odata service

sap.ui.getCore().byId('smartIdid').setEntitySet(this.Path);

sap.ui.getCore().byId('smartIdid').rebindTable();

}

onBeforeRebindTable: function (oEvent) {

var mBindingParams = oEvent.getParameter("bindingParams");

mBindingParams.parameters["expand"] = "ValuesSet"; // Expand entity under main entity , data under expand entity changes based on the filter we provide in the main entity , we should bind the data in expand entity to smart table

},

maheshpalavalli
Active Contributor

Didnt understand your issue properly, do you mean that you want to bind the expand endityset to the smart table(to show the association data in the table) instead of normal entityset?

VenkateshThota
Explorer

Hi Mahesh

yes, you are correct mahesh , like to bind the expand entityset to smart table

Thanks

View Entire Topic
maheshpalavalli
Active Contributor
0 Kudos

hi venkatesh,

You can check the below answer

https://stackoverflow.com/questions/32068154/sapui5-how-to-bind-smart-table

You need to use tablebindingpath to pass the expand entity

Regards,

Mahesh

VenkateshThota
Explorer
0 Kudos

Hi Mahesh

The columns under the expand entity will keep changing based on the filters we provide to the main Entity

will smart table able to display those dynamic columns under expand entity?

Thanks

Venkatesh

maheshpalavalli
Active Contributor
0 Kudos
venkateshthotahyd19 any reason why you want to display them dynamically, we usually show only one type of columns for a single entity right?but anyways, if you want to do that, check "setInitiallyVisibleFields" methods, which probably can be used in your requirement (not sure if it works everytime you navigate)

https://ui5.sap.com/#/api/sap.ui.comp.smarttable.SmartTable%23methods/setInitiallyVisibleFields