cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

getItems() method for table returns up to 20 rows

Former Member
0 Likes
2,374

Hi experts,

I have a report table that is populated in three different ways, depending on selection filters. At the end of the called report I use the "updateFinished" event to loop through the table entries, paint them zebra style and paint last summary line pink.

SAPUI5 Application version is 1.44.12

                        this.oStsTable = this.getView().byId("statusReportTable");

                        this.oStsTable.attachEventOnce("updateFinished", function(oEv) {
                            var aItems = oEv.getSource().getItems();
                            if (aItems && aItems.length > 0) {
                                for (var i = 0; i < aItems.length; i++) {
                                    if (i === aItems.length - 1) {
                                        aItems[i].addStyleClass("pinkBackground");
                                    } else { 
                                        var even = i % 2;
                                        if (even !== 0 && i < aItems.length) {
                                            aItems[i].addStyleClass("cyanBackground");  
                                        }                       
                                    }
                                }
                            }
                        });                         

                        this.byId("statusReportTable").getBinding("items").filter(oTableSearchState);

With the data available, I get back 3 datasets. 7 for case 1, 7 for case 2 and 23 for case 3. With the first two cases everything is OK. Problem is with case 3 (23 records). Debugging on the back-end, I see 23. When table appears, I see again 23. But the getItems() method within "updateFinished" event sees only 20 (!). As result of it (yes, guessed right), line 20 goes pink and the remaining lines without color as loop exits.

Rings any bells?

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate

Hi Gregory,

I suppose the problem you encountered is caused by the way UI5 list handle aggregations. To save memory the list only generates 20 items and fetches and generates another 20 once you scroll down (https://sapui5.hana.ondemand.com/#/api/sap.m.ListBase/methods/setGrowingThreshold).

Can you check if the problem is still there if you change the growingthreshold?

PS: I would recommend to implement such a feature with CSS

Marius

Former Member
0 Likes

This was exactly the case, worked like a charm, thank you!

Answers (1)

Answers (1)

jorge_cabanas
Participant

Hi,

Could you show the debug calls with the data?