PDA

View Full Version : Number of items in a List or Store?



Jiawei Yong
14 Jan 2012, 4:40 AM
Hi,

I'm not sure if I missed it in the API documents, but is there any way I can retrieve the number of items in a list, or the number of items in the store associated with the list?

NMFord
14 Jan 2012, 6:45 AM
Try getCount()

Jiawei Yong
14 Jan 2012, 7:45 AM
Thanks! Working fine now though I'm wondering how did I even miss that :)

mcbl
19 Jun 2012, 5:07 AM
But it's only available for a Store and will retrieve the load operation's number of records. :s

tnedeles
8 Nov 2012, 11:41 AM
Hi,

I am not using a store. I fill the list from within the controller, by inserting elements, as the following:
myList.insert(0, {xtype: 'textfield', value: 'abc'});

I tried getCount() and I got the result 0:
console.log("Length of list is " + myList.getCount());

Clearly, getCount() does not work for my example. What would you recommend me to use instead ?

Thank you