This is a migrated thread and some comments may be shown as answers.

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

1 Answer 41 Views
Sample Applications
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jia
Top achievements
Rank 1
Jia asked on 19 May 2015, 02:21 PM

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!

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 21 May 2015, 06:00 AM
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
Tags
Sample Applications
Asked by
Jia
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or