Count the rows in list (or) number of List items

Providing the dataprovider to the list will bring up the list items.

<mx:List height=”120″  id=”searchlist”
dataProvider=”{}” labelField=”name”>

here in above example the data comes from the httpservice, sendsearch is the Id of the httpservice , and reading the data from php page.

Now to count the number of rows fetched to the list and avilable in the list we have to use the property called length.

{searchlist.dataProvider.length} — this will give length of the list (rows).


10 Responses to Count the rows in list (or) number of List items

  1. Sam says:

    Thanks Kumar!

  2. sooltaan says:

    that exactly what i was looking for…

    also if u dropped items on the list (by dnd) it will still give u the correct number of items on the list …
    sp if u have a data provider that contains to elements and assigned it to the list … then you dragged 2 other items to the list it will give you 4 ^_^

  3. gehan says:

    correct on the point
    i just had this doing by the rowCount which only gives me only the items which are visible

    u had me save a day

  4. gehan says:

    hi but this want work for a tree control
    which has recursive children in the dataprovider

    any suggestion on getting the complete item count ?

  5. Sam P says:


  6. Thanx for this useful info.I have a similar question.
    How to get the number of rows returned in a ResultEvent object which get binded to a Column Chart control as shown below

    columnChart1.dataProvider = resultEvent.result;


  7. dario says:

    tks dude

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: