cancel
Showing results for 
Search instead for 
Did you mean: 

SmartTable switch entity set

Former Member

I am trying to determine if this is even possible, and I have somewhat been successful so far, though I am missing something.

I have a SmartTable configured:

<smartTable:SmartTable id="gSmartTable" smartFilterId="gSmartFilterBar" enableAutoBinding="true" useVariantManagement="true" useTablePersonalisation="true" persistencyKey="gSmartTable_Explored" showRowCount="true" demandPopin="true">

In my view, I am using a MenuButton control with two options. When I select either option, I want to bind the SmartTable to the appropriate entity set:

onMenuAction: function(oEvent) 
{var oViewModel = this.getModel("view");<br>var oItem = oEvent.getParameter("item");<br>var oSmartTable = this.byId("gSmartTable");<br>var oMenuButton = this.byId("menuButton");<br>//var sItem = oItem.getText();<br>if (oItem.getText().indexOf("Contact") > -1) {<br>oMenuButton.setText("Contacts");<br>oViewModel.setProperty("/entityName", "Contact");<br>//oSmartTable.setTableBindingPath("Contact");<br>oSmartTable.setEntitySet("Contact");<br>oSmartTable.setHeader("Contacts");<br>//oSmartTable.rebindTable();<br>}<br>if (oItem.getText().indexOf("Client") > -1) {<br>oMenuButton.setText("Clients");<br>oViewModel.setProperty("/entityName", "Client");<br>//oSmartTable.setTableBindingPath("Client");<br>oSmartTable.setEntitySet("Client");<br>oSmartTable.setHeader("Clients");<br>//oSmartTable.rebindTable();<br>}<br>//oSmartTable.rebindTable();<br>//oSmartTable.fireInitialise();}

When the view loads, initially nothing is in the table. I can select one of the menu items, and it will bind the SmartTable correctly. However, if I select the other option, nothing happens. I attempted to pass the 'rebindTable()' method, but of course it complains the columns do not exist (different columns for each entityset). I am not sure if there is another approach. I don't know of a method which completely clears the binding. If that could be done first, I could possibly then 'setEntitySet' and it would reload the table with the appropriate data.

Any help would be appreciated!

Accepted Solutions (0)

Answers (0)