Property | Type | Description | |
---|---|---|---|
$id | an ID that uniquely identifies the data provider among all data providers. You should set this property if the same page contains two or more different data providers. Otherwise, the [[pagination]] and [[sort]] may not work properly. |
Method | Description | |
---|---|---|
getCount ( ) : integer | Returns the number of data models in the current page. | |
getKeys ( ) : array | Returns the key values associated with the data models. | |
getModels ( ) : array | Returns the data models in the current page. | |
getPagination ( ) : |
Returns the pagination object used by this data provider. | |
getSort ( ) : |
Returns the sorting object used by this data provider. | |
getTotalCount ( ) : integer | Returns the total number of data models. | |
prepare ( boolean $forcePrepare = false ) | Prepares the data models and keys. | |
refresh ( ) | Refreshes the data provider. | |
setKeys ( array $keys ) | Sets the key values associated with the data models. | |
setModels ( array $models ) | Sets the data models in the current page. | |
setPagination ( array | |
Sets the pagination for this data provider. | |
setSort ( array | |
Sets the sort definition for this data provider. | |
setTotalCount ( integer $value ) | Sets the total number of data models. |
Method | Description | |
---|---|---|
prepareKeys ( array $models ) : array | Prepares the keys associated with the currently available data models. | |
prepareModels ( ) : array | Prepares the data models that will be made available in the current page. | |
prepareTotalCount ( ) : integer | Returns a value indicating the total number of data models in this data provider. |
public getPagination ( ) : |
||
return | the pagination object. If this is false, it means the pagination is disabled. |
public getTotalCount ( ) : integer | ||
return | integer | total number of possible data models. |
abstract protected prepareKeys ( array $models ) : array | ||
$models | array | the available data models |
return | array | the keys |
abstract protected prepareModels ( ) : array | ||
return | array | the available data models |
abstract protected prepareTotalCount ( ) : integer | ||
return | integer | total number of data models in this data provider. |
public refresh ( ) |
public setPagination ( array | |
||
$value | array | |
the pagination to be used by this data provider. This can be one of the following: - a configuration array for creating the pagination object. The "class" element defaults to 'yii\data\Pagination' - an instance of [[Pagination]] or its subclass - false, if pagination needs to be disabled. |
public setSort ( array | |
||
$value | array | |
the sort definition to be used by this data provider. This can be one of the following: - a configuration array for creating the sort definition object. The "class" element defaults to 'yii\data\Sort' - an instance of [[Sort]] or its subclass - false, if sorting needs to be disabled. |
public setTotalCount ( integer $value ) | ||
$value | integer | the total number of data models. |