Skip to Content
avatar image
Former Member

Extracting selected rows data from sap.m.Table in MultiSelect mode

Hello colleagues,

I have a table in MultiSelect mode as follows:

I need to extract the data (the text field value and the text of the selected items from the MultiCombo) for each selected row.

Regards,

Ivan

asd.jpg (32.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 22, 2016 at 06:26 PM

    Hi Ivan,

    Retrieve the table by using the id mentioned in the view.

    If you are using json model and setting it to the table, then you can extract the data entered in the table by using "getModel().oData" as json model is two-way binding by default.

    To do the same use "selectedKeys" property in the "MultiComboBox".

    <MultiComboBox selectedKeys="{selItems}" >

    Now while retrieving use the code : in record i'm storing one item,

    var selContexts = oTable.getSelectedContexts();
    var id="", selItems = [], record = {}; 
    for(var i=0;i<selContexts.length;i++)
    {
       record = oTable.getModel().getProperty(selContexts[i].sPath);// one item
       id = record.id;
       selItems = record.selItems; // it is array of strings
    }
    
    Add comment
    10|10000 characters needed characters exceeded