Reputation: 740
I am using the List Report template to implement an SAP Fiori app. The type of table is sap.ui.table.Table
I have added an extension for action to add a 'Download' button and I have set it's requiresSelection
value to true
. But I am not able to fetch the table selection.
I receive error
"Unsupported operation: sap.ui.table.Table#getSelectedIndices must not be called if a selection plugin is applied."
for the below statement:
var oTable = oEvent.getSource().getParent().getParent().getTable(); //which fetches the table inside Smart Table control oTable.getSelectedIndices();
Please help.
Upvotes: 2
Views: 3582
Reputation: 77
To get the selected index for a sap.ui.table or Grid Table
try this, var oSmartTable = oEvent.getSource().getParent().getParent().getContent().getTable();
You cannot use getSelectedIndices() directly on table control, so use the below
oSmartTable.getPlugins()[0].getSelectedIndices();
Upvotes: 0
Reputation: 1
Try:
oTable._getSelectionPlugin().getSelectedIndices()
Upvotes: -2
Reputation: 11
Try this: Inorder to get the selected indices for the above error you are getting
var oTable = oEvent.getSource().getParent().getParent().getTable();
oTable.getAggregations("plugins")[0].getSelectedIndices();
Upvotes: 1