Reputation: 111
Is it possible to get the values from a sap.m.Table without clicking a specific entry?
With an event I can get the values by the actual context but what I need is to get the whole items with the specific characteristic.
For example my table has the following columns (column D is not invisible):
A B C D
with the entries shown below:
A B C D
1 2 3 4
4 b 2 1
What I need now is the first row for example:
1 2 3 4
I want to write something like
table.getItem("A")[0]
to get 1 as a result.
How can I achieve this?
Upvotes: 0
Views: 16339
Reputation: 3994
You can get all the Items in the table using getItems(), which will give you an Array of Items. You can then get the bindingContext for any of the Items.
var iRowIndex = 0; //For First row in the table
var oTable = this.getView.byId("myTable"),
oModel = oTable.getModel(),
aItems = oTable.getItems();
if(iRowIndex < aItems.length){
oModel.getProperty("ColA",aItems[iRowIndex].getBindingContext());
}
Upvotes: 4