d33a
d33a

Reputation: 740

How to fetch row selection in Smart Table in List Report SAP Fiori app?

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

Answers (3)

srikar nagadevara
srikar nagadevara

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

Try:

oTable._getSelectionPlugin().getSelectedIndices()

Upvotes: -2

Sri Ramani
Sri Ramani

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

Related Questions