Looking for guidance on deleting a row from a table that is linked with jModel upon clicking the trash button.
https://i.sstatic.net/rjqwK.png
Here is the data:
_data: {
requestSpecific: [{nArt= "A002", name="Computador, quantity=2},{},{...}],
items: [],
partner: [],
vatGroups: [],
countries: [],
totals: [],
ttlstotais: []
},
The model name is jModel. I may have made mistakes in the model setup here, but the code seems fine.
The table is set as a grid table in Single mode.
Below is the event triggered by the "trash" button.
onDelArtigoPress: function (oEvent) {
var iIndex = oTable.getSelectedIndex();
var jData = this.jModel.getProperty("/requestSpecific");
var sMsg;
if (iIndex < 0) {
sMsg = "Please select an item to delete";
} else {
//// 1st - remove the object from the model
//// 2nd - refresh the model, which will automatically update the table
}
}
I am facing difficulty with the first step. I believe I need to use the splice prototype method, but I do not know how to determine the position of the object in the array (jModel).
If you can provide assistance, it would be greatly appreciated!