CActiveDataProvider - Is there a "current Item Number"-Method ?


I use a regular CActiveDataProvider to fill my view.

I know that you can get the "totalItemCount" via totalItemCount

Is there a way to get the "current Item Number" when processing it in the view?

Lets say I have 20 results and I want Result 5 and 7 look different.

Is there a way to do it?



Well, at least within CGridView you can rely on $row containing the current item number. Should work in CListView as well.

Da:Sourcerer: In CListView it would be $index:

is there a solution for this problem?

i am facing exactly the same problem and i think it’s a problem that every web developer would encounter sooner or later !

shgpan what problem are you referring to ??? The one asked in this thread has been responded by DA:sourcer and Mike.

to show number in CListView, u can try :

[font="Courier New"]<?php echo $widget->dataProvider->pagination->currentPage*$widget->dataProvider->pagination->pageSize + $index+1;?>[/font]