AutoCountSqlDataProvider extends the CSqlDataProvider. It adds the ability to use pagination without first counting all the rows, thus increasing the performance when browsing large tables.
None
# table_name has 15 rows. $provider = new AutoCountSqlDataProvider( 'table_name', new CDbCriteria(array('condition'=>'column1 is not null')), false, array( 'sort'=>array( 'attributes'=>array('column1','column2'), ), 'pagination'=>array( 'pageSize'=>10, ), ) ); $rows = $provider->fetchData(); # count($rows) == 10 # $provider->hasMore == true # $provider->getTotalItemCount() == 10 $rows = $provider->fetchData(); # count($rows) == 5 # $provider->hasMore == false # $provider->getTotalItemCount() == 15
Be the first person to leave a comment
Please login to leave your comment.