Skip to Content
0
Former Member
Dec 23, 2015 at 07:44 PM

how to update table or model on button click

848 Views

I have one table on hana DB, exposed it as xsodata service

service  {
    "schema"."table" as "OrderItem";
  }


showing the in ui5 app as

var Model = new sap.ui.model.json.JSONModel("../../services/myexp.xsodata/OrderItem", false);
sap.ui.getCore().setModel(Model,'myitem');

var oTemplate = new sap.m.ColumnListItem({
        cells : [
            new sap.m.Text({
                text : "{myitem>Component}"
            }),
            new sap.m.Text({
                text : "{myitem>Customer}"
            }),
            new sap.m.Text({
                text: "{myitem>Required Date}"
            }),
            new sap.m.Text({
                text : "{myitem>Status}"
            })
        ]
    });
oTable.bindItems("myitem>/d/results", oTemplate);


Working fine

Now as in image I have two buttons added at the page footer as

footer: new sap.m.Bar({
                contentRight: [
                    new sap.m.Button({
                    text: "Accept",
                    type: sap.m.ButtonType.Accept
                  }),
                new sap.m.Button({
                    text: "Reject ",
                    type: sap.m.ButtonType.Reject ,
                   })
                ]
})


now my question is how to update the Status column on click of any button, say If i press accept status will change to accepted and same with reject. (updating the model. I guess hana table will automatically update as tyhe table is expossed as odata model)

note this table will have only one row.

Thank you

Attachments

Untitled.png (7.1 kB)