Count no.of items loaded in a list

How do i count no.of items loaded in a list or rows in a grid.

var count = $$('list').dataCount()

Be sure to call it after data loading ( from loading callback for example ) as data loading is async process

Thanks for the reply

if i call it on onxle event, then?

Yep, onXLE is a good place for such logic

$$('list').attachEvent("onXLE", function(){ alert(this.dataCount()); });