Paging in CListView


in my web application I’m using Firebird database, so I’m currently not able to use CActiveRecord class (and other relative classes) implemented in Yii framework. I had to write my own classes to access database.

I had to also override CDataProvider class in order to show my data in CListView widget. But I don’t know how to implement paging in my ListView. My question is: is it possible to use pagination in CListView in this case or what I have to override in order to make it work. Thanks.

I have some data in a generic array:

$myData = array (

    array ('prop1' => 'val11', 'prop2' => 'val12'),

    array ('prop1' => 'val21', 'prop2' => 'val22'),

    array ('prop1' => 'val31', 'prop2' => 'val32'),



I want this data to display in CListView and apply paging.

Can somebody give me simple example how to do it? Thanks.

CListView fetchs the data from a data provider (an object whose class implements the interface IDataProvider). I never tryed to set the data of a dataprovider directly from an array. I think that the concept of a data provider is the one of an object that can fetch data for his own once configured.

I think that if you have correctly implemented CActiveDataProvided, the pagination should be working. You must set the property pagination when creating the data provider.

Then, the pagination elements should automatically appear when the data items exceeds the constant PAGE_SIZE of the current controller.

I think with the next code it should be working:


  // here you create your data provider instance

  $dataProvider->pagination= array('pageSize'=>self::PAGE_SIZE);









_view.php displays the items of the listing. It has defined the object $data with the proper properties.

How about in Gridview ? I’m using Firebird database too. I list my data in gridview, pagination doesnt work well, its bring me first 10 of 15 records (1-10 / 15.)…

When i click page 2 its only show me 11th record.(11-11 / 15).

How can i fixed that? I need your helps…