Search code examples
odatasapui5hana

How to deal with odata service created with 1000 rows of hana table in SAP hana XS app


I have a table of 1000 rows in Hana.

Then I created an odata service on that table using xsodata service to expose the data as odata.(working fine)

Now I want to use this on my XS app as list.

The problem is as there is 1000 rows the list is not loading all the data, it's showing the first record and the busy indicator showing 1/1000 more.

Error on console: getTimer is not a function. ( this part I did not get)

Now my question is how to get all the data(1000 rows) on the list, say loading 10 at first, and then I scroll down to show more.

Thanks


Solution

  • Good for you: Lazy loading is a built-in feature of SAPUI5 :)

    Just add some extra properties to your list

    <List id="contractList"
        growing="true"
        growingScrollToLoad="true"
        growingThreshold="10"
        items="{MyItems}">
    
        <StandardListItem title="{MyTitle}" description="{MyDescription}" press="onPress" />
    
    </List>
    

    The growing property enables (or disables) the lazy loading. The growingScrollToLoad enables loading via scrolling. If false, there is a button to load more items. The growingThreshold defines how many items will be fetched each time.

    See the API for more information: https://openui5.hana.ondemand.com/docs/api/symbols/sap.m.ListBase.html


    However this will not solve your other problem (getTimer is not a function). You should try to solve that before implementing lazy loading.