NativeScript, Sample-Cuteness from GitHub, ListView Items Array, Does the length of array has to be fixed?

2 posts, 0 answers
  1. Jia
    Jia avatar
    3 posts
    Member since:
    Jan 2014

    Posted 19 May 2015 Link to this post

    Hi all,

    In this project, sample-cuteness: https://github.com/NativeScript/sample-cuteness

    it return json from web service and load data into a virtual array. And bind that array to a ListView to show the data. As scrolling down the listview, more data would be returned and loaded.

    It creates a virtual array with specific length, 1000, and it seems that web service could return more than that.

    My questions is does the length of array that bind to listview as to be specific?

    Since I created my app and return less data than the array, and there would be blank rows at the end. What if the return data exceeds the length?

    thank you!

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 21 May 2015 Link to this post

    Hello,

    You can increase the length until the level of performance is acceptable for your application. From the docs:

    "Use "length" property set via VirtualArray constructor to specify total number of items, "loadSize" to specify number of items to be requested in a single request, "itemsLoading" event to handle items request and "load()" method to copy items into the array. All already loaded items are cached in -memory and when "getItem()" method is called the array will raise "itemsLoading" event for still not loaded items."

    Regards,
    Rossen Hristov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top