It seems that oList is not a member of the binding object for my scenario.
I'm trying to do the same thing with a sap.m.table and an oData model.
binding.oLastContextData seems to work in this case, but this also means index is not an integer, rather a path to the OData entity. You need to increment your own index.
getTableRowIndex: function(id) {
var i = 0;
if (id != null && id != undefined) {
var binding = this.byId("tblWidgets").getBinding("items");
$.each(binding.oLastContextData, function(index, object) {
i++;
if (object.WidgetId== id) {
return false; //exit $each, not function
}
});
}
return i;
}
Hope this helps others display the index / counter of a table row.