Skip to Content

oData binding is not updating table row count. How to access the cells?

Hi All,

I have an app with a sap.ui.table, I have bound some data (referred to as 'entries' in the rest of this) to the table's rows. I set the visibleRowCount to 13 in the table. The table is created in an XML view and the binding + visible row count is set in the XML. Updatebindings is called whenever a new entry is added so the table also gets a new row.

In addition to accessing the entries, I also need access the table's cells directly to set their background color, we need to color code table cells based on different statuses in the entries. So the way try to do this is table.getRows()[entryNumber]. This seems like it would work because the number of table rows visible on the screen matches the number of entries (as it should since I bound the model to the table rows). But this is causing the app to crash when the code to color code the cells is called. When I debug, i see that even though my visible table has say 20 rows based off of the 20 entries bound to it, table.getRows() always returns 13 (the initial value of the visibleRowCount).

Has anyone had a similar problem? Or know how I can keep the getRows() count in line with the number of rows actually shown on the screen? Or how to access the cells somehow based on the oDataModel?

Thanks for the assistance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 16, 2016 at 06:54 PM

    In case anyone else sees this and has a similar problem, I had to work around by calling setVisibleRowCount whenever the # of entries exceeded the current count. It work now but this seems to be a bug in the UI5 data binding code itself. I am not sure how the visible rows on the screen were being incremented but the actual table.getRows() were not.

    Add comment
    10|10000 characters needed characters exceeded