Skip to Content
0
Former Member
Aug 28, 2013 at 12:59 PM

How to get model data from table row

3127 Views

Dear all,

I've a JSON Model binded to a Table-Control. The last column of my table control contains a button. How can I access in the Press-Event the data or the row which contains the button fired the press event?

var oTable = new sap.ui.table.Table({            id: "employeeListTable",            columns: [                          new sap.ui.table.Column({                              label: new sap.ui.commons.Label({text: "Vorname"}),                            template: new sap.ui.commons.TextView().bindProperty("text", "firstname"),                            sortProperty: "name",                            filterProperty: "name",                          }),                          new sap.ui.table.Column({                              label: new sap.ui.commons.Label({text: "Nachname"}),                            template: new sap.ui.commons.TextView().bindProperty("text", "lastname"),                            sortProperty: "name",                            filterProperty: "name",                          }),                          new sap.ui.table.Column({                              label: new sap.ui.commons.Label({text: "Alter"}),                            template: new sap.ui.commons.TextView().bindProperty("text", "age"),                            sortProperty: "name",                            filterProperty: "name",                          }),                          new sap.ui.table.Column({                              label: new sap.ui.commons.Label({text: "Aktionen"}),                            template: new sap.ui.commons.Button({                                text: "Bearbeiten",                                press: oController.onEditButtonClicked                                                        }),                            sortProperty: "name",                            filterProperty: "name",                          }),                      ],        });                var oModel = new sap.ui.model.json.JSONModel();        oModel.loadData("data/employees.json");        oTable.setModel(oModel);        oTable.bindRows("/employees");

Thanks!