cancel
Showing results for 
Search instead for 
Did you mean: 

SmartTable - Get the Selected Table Row Data

Hi,

Unable to get the Selected Row Data in a SmartTable .Tried to implement the fieldChange event but it is not even trigger when any checkbox is selected.

On XML View fieldChange="onFieldChange"

Controller: onFieldChange : function(oEvent){ debugger; }

Also Tried ->Button Press event

var ob = this.getView().byId("LineItemsSmartTable").getTable().getSelectedIndices(); -> I am getting the list of Selected index in an array but from index how to get the complete row data.

The Requirement is on click of submit button process the selected records as a post call.

Accepted Solutions (1)

Accepted Solutions (1)

former_member524141
Participant

Hi Sunil,

Use below code,on button press event.

var oItems = oTable.getSelectedIndices();
      for (var i = 0; i < oItems.length; i++) {
        j = oItems[i];
        var l_ekgrp = oTable.getContextByIndex(j)
          .getProperty("Docnum");
        // and fetch rest of fields in similar pattern
 
}

And as Mahesh Kumar Palavalli mentioned Field change event is not required in your case. It is for data change of fields.

0 Kudos

Thanks Ravi

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor

Hi sunil das

Field change event is not for that it's when the smartfiled data is changed.. What you are looking for is selection change..

You can ddo it is in 2 ways

1. Pass the UI.table inside the smart table and use the SelectionChange event.

2. or get the reference of the smart table in on int or after rendering and get the this.oSmartTable.getTable().attachRowSelectionChange

Thanks,
Mahesh