IDataProvider
Package | system.web |
---|---|
Inheritance | interface IDataProvider |
Subclasses | CActiveDataProvider, CArrayDataProvider, CDataProvider, CSqlDataProvider |
Since | 1.1 |
Version | $Id: interfaces.php 3515 2011-12-28 12:29:24Z mdomba $ |
Source Code | framework/base/interfaces.php |
IDataProvider is the interface that must be implemented by data provider classes.
Data providers are components that can feed data for widgets such as data grid, data list. Besides providing data, they also support pagination and sorting.
Data providers are components that can feed data for widgets such as data grid, data list. Besides providing data, they also support pagination and sorting.
Public Methods
Method | Description | Defined By |
---|---|---|
getData() | Returns the data items currently available. | IDataProvider |
getId() | Returns the unique ID that identifies the data provider from other data providers. | IDataProvider |
getItemCount() | Returns the number of data items in the current page. | IDataProvider |
getKeys() | Returns the key values associated with the data items. | IDataProvider |
getPagination() | Returns the pagination object. If this is false, it means the pagination is disabled. | IDataProvider |
getSort() | Returns the sorting object. If this is false, it means the sorting is disabled. | IDataProvider |
getTotalItemCount() | Returns the total number of data items. | IDataProvider |
Method Details
getData()
method
abstract public array getData(boolean $refresh=false)
| ||
$refresh | boolean | whether the data should be re-fetched from persistent storage. |
{return} | array | the list of data items currently available in this data provider. |
Returns the data items currently available.
getId()
method
abstract public string getId()
| ||
{return} | string | the unique ID that identifies the data provider from other data providers. |
getItemCount()
method
abstract public integer getItemCount(boolean $refresh=false)
| ||
$refresh | boolean | whether the number of data items should be re-calculated. |
{return} | integer | the number of data items in the current page. |
Returns the number of data items in the current page.
This is equivalent to count($provider->getData())
.
When pagination is set false, this returns the same value as totalItemCount.
getKeys()
method
abstract public array getKeys(boolean $refresh=false)
| ||
$refresh | boolean | whether the keys should be re-calculated. |
{return} | array | the list of key values corresponding to data. Each data item in data is uniquely identified by the corresponding key value in this array. |
Returns the key values associated with the data items.
getPagination()
method
abstract public CPagination getPagination()
| ||
{return} | CPagination | the pagination object. If this is false, it means the pagination is disabled. |
getSort()
method
abstract public CSort getSort()
| ||
{return} | CSort | the sorting object. If this is false, it means the sorting is disabled. |
getTotalItemCount()
method
abstract public integer getTotalItemCount(boolean $refresh=false)
| ||
$refresh | boolean | whether the total number of data items should be re-calculated. |
{return} | integer | total number of possible data items. |
Source Code: framework/base/interfaces.php#585 (show)
public function getTotalItemCount($refresh=false);
Returns the total number of data items. When pagination is set false, this returns the same value as itemCount.