Skip to content

yiiext/active-data-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

ActiveDataProvider

Use data provider as active record behavior.

Usage:

Attach behavior to your model

class Post extends CActiveRecord
{
	public function behaviors()
	{
		return array(
			'dataProvider' => array(
				'class' => 'ActiveDataProvider',
				'criteria' => array(
					'scopes' => array(
						'filterByAttributesValues',
						'defaultOrder',
					),
					'with' => 'category',
				),
				'pagination' => array(
					'pageSize' => 30,
					'pageVar' => 'page',
				),
			),
		);
	}
}

Now in view file can us this provider

$model = new Post('search');
$this->widget('CGridView', array(
	'dataProvider' => $model->dataProvider,
));

The component is back compatible to old code

$model = new Post('search');
$this->widget('CGridView', array(
	'dataProvider' => $model->search(),
));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages