Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UI5 Table getRows() returns rows array size below the visibleRowCount limit


When my table rows # exceed the numbers of visibleRowCount (be the rows then available thru scrollbar or navigation pages), i can't access programmatically the rows objects selected (and no access to model, binding path, etc...);

Indeed, it is the API Table.getRows() api that only returns the first # of rows < visibleRowCount, whatever the current table view status is (scrolled, paginated, or not)

I've written a short sample on JSBin here


  var idx = oTable.getSelectedIndex();

  var row = oTable.getRows()[idx];

  //row returns undefined if idx > visibleRowCount


I'm using version 1.24.4.

Does anybody have a clue of what i'm missing here to get access to this row objects  ?

Is it an expected behaviour ?

Note that, as workarounds, i tried:

a) access these by using

Table.attachRowSelectionChange{function (oEvent)}




But that is very cumbersome as i'd have to manage my own maps for multiple selections & selecting/unselecting...

b) don't use the rows to get back to the model, directly hardcode mybindingPath="/model/" + idx;

But that does not match if the index list is altered thru a table sorting for example.

Thanks a lot for any clue!


Former Member

Hi Marc,

I think the following will be *much* easier for you, and it works regardless of client-side sorting/filtering:

var aSelectedIndices = oTable.getSelectedIndices();

for (var i=0; i<aSelectedIndices.length; i++) {

    var oData = oTable.getContextByIndex(aSelectedIndices[i]);

    // do whatever you want with the current oData object


EDIT: In your case, if you need the ID of the current object, simply use this in the for-loop:

var myId = oData.getObject().id;

Message was edited by: Robin van het Hof

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question