Skip to Content
avatar image
Former Member

Need to Update particular cell of selected Row of table in FIORI app.

Hi Experts,

I have an functionality of adding row in table and there is option of Fast entry.Suppose i have added 3 rows to table and selected 2 rows in table in which i need to update quantity field.

Now the scenario is like I will select quantity field from dropdown and put some quantity.It will update all as below.

As you can see in above image I have selected 2 rows and want to update quantity field of both selected rows.
Please guide me how to get the selected row and update particular quantity field.

I have done the coding as below partially but need guidance to update particular cell of quantity.

onEditPo: function() { //This code was generated by the layout editor.

var oView = this.getView();

var select = this.getView().byId("FastEntrySelect").getSelectedItem();

var temp = select.getText();

if (temp === "Fixed date and quantity")

{

///update all qty

var oModel = new sap.ui.model.json.JSONModel();

var oTable = this.getView().byId("tableId");

var oselectedItem = oTable.getSelectedItem();

var aggregations = oTable.getAggregation("items");

var index = aggregations.indexOf(oselectedItem);

}

Waiting for response.

Thanks.

Abhi

rows.png (47.7 kB)
fastentry.png (42.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 16, 2017 at 11:51 AM

    Hi Abhishek,

    var oTable = this.getView().byId("tableId");

    var contexts = oTable.getSelectedContexts();

    if (contexts.length === 0){

    //Line items are not selected

    } else {

    var items = contexts.map(function(oEvent){

    return oEvent.getObject();

    });

    var i;

    for(i=0;i<items.length;i++)

    {

    var oNewObject = {};

    oNewObject = items[i]; //items contains the selected line item data and you can continue with your logic

    }

    }

    Best Regards,

    Deepak.

    Add comment
    10|10000 characters needed characters exceeded