Hi,
I have created a table in xml view and i am binding its cell contents with json in controller.js.
Following is the code i have written to add delete button in the table for every row:
var oTable = this.getView().byId("adjustTable");
var mytemplate = new sap.m.ColumnListItem(
{
type : "Navigation",
cells : [
new sap.m.Text({
text : "{action}"
}),
new sap.m.Text({
text : "{item}",
}),
new sap.m.Text({
text : "{main}"
}),
new sap.m.Text({
text : "{Product}"
}),
new sap.m.Text({
text : "{status}"
}),
new sap.m.Text({
text : "{usage}"
}),
new sap.m.Text({
text : "{unit}"
}),
new sap.m.Text({
text : "{gross_amt}"
}),
new sap.m.Text({
text : "{tax}"
}),
new sap.m.Text({
text : "{c_smfld}"
}),
new sap.m.Text({
text : "{net}"
}),
new sap.m.Text({
text : "{c_smfld1}"
}),
new sap.m.Text({
text : "{ref_doc}"
}),
new sap.m.Button(
{
icon : "sap-icon://sys-cancel",
press : function(evt) {
if (evt.getSource().getParent().getParent().getItems().length > 0) {
row = evt.getSource().getParent().getId();
evt.getSource().getParent().getParent().removeItem(row);
}
},
}),
]
});
oTable.bindAggregation("items", {
path : "/LineItems/",
template : mytemplate
});
},
The delete button code is not working as it is not being reflected on ui. For now i am running the app on localhost using JSON data.
I want to add two buttons on every row of the table, one for adding a new row denoting plus sign button and another deleting a row denoting cross sign button.
Please share your inputs.
Thanks,
Saurabh.