system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.cubrid system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.gii system.i18n system.i18n.gettext system.logging system.test system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.form system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers zii.behaviors zii.widgets zii.widgets.grid zii.widgets.jui

IDataProvider

system.web
继承 interface IDataProvider
子类 CActiveDataProvider, CArrayDataProvider, CDataProvider, CSqlDataProvider
可用自 1.1
源码 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.

公共方法

隐藏继承的方法

方法描述被定义在
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

方法详情

getData() 方法
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.
源码: framework/base/interfaces.php#587 (显示)
public function getData($refresh=false);

Returns the data items currently available.

getId() 方法
abstract public string getId()
{return} string the unique ID that identifies the data provider from other data providers.
源码: framework/base/interfaces.php#566 (显示)
public function getId();

getItemCount() 方法
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.
源码: framework/base/interfaces.php#574 (显示)
public function getItemCount($refresh=false);

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() 方法
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.
源码: framework/base/interfaces.php#594 (显示)
public function getKeys($refresh=false);

Returns the key values associated with the data items.

getPagination() 方法
abstract public CPagination getPagination()
{return} CPagination the pagination object. If this is false, it means the pagination is disabled.
源码: framework/base/interfaces.php#602 (显示)
public function getPagination();

getSort() 方法
abstract public CSort getSort()
{return} CSort the sorting object. If this is false, it means the sorting is disabled.
源码: framework/base/interfaces.php#598 (显示)
public function getSort();

getTotalItemCount() 方法
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.
源码: framework/base/interfaces.php#581 (显示)
public function getTotalItemCount($refresh=false);

Returns the total number of data items. When pagination is set false, this returns the same value as itemCount.