I want to use a CListView, I have created my CActiveDataProvider, but I cannot limit the number of records, the property ‘limit’ just doesn’t work here, I have checked this in the wiki.
In order to get this work, I haven’t used CListView, just CActiveRecord and foreach bucle, but I’m curious to know if there is a way to limit in CActiveDataProvider.
I figured something out…
Using pagination and template properties:
//When you create your CActiveDataprovider:
$dataProvider=new CActiveDataProvider('table', array(
//When you use CListView, add this property:
The pager won’t be displayed, but now my doubt is… When we create the CActiveDataProvider, is it getting every single record of the table??? I mean… It won’t be so effective for the DB in case you have a lot of records in that table. Any opinion?
hi friends you can set limit
$dataProvider=new CActiveDataProvider('model', array(
'pagination' => array('pageSize' => 8,),
'totalItemCount' => 8,
it returns only 8 records from your database.