IDataProvider

优质
小牛编辑
122浏览
2023-12-01
所有包 | 方法
system.web
继承interface IDataProvider
子类CActiveDataProvider, CArrayDataProvider, CDataProvider, CSqlDataProvider
源自1.1
版本$Id: interfaces.php 3515 2011-12-28 12:29:24Z mdomba $
源码framework/base/interfaces.php
IDataProvider是数据提供者类必须实现的接口。

数据提供者组件能够为挂件,如data grid,data list提供数据。 除了提供数据,它也支持分页与排序。

公共方法

隐藏继承方法

方法描述定义在
getData()返回当前可用数据项。IDataProvider
getId()返回唯一ID用来区分其它数据提供者。IDataProvider
getItemCount()返回当页面数据项的数量。IDataProvider
getKeys()Returns the key values associated with the data items.IDataProvider
getPagination()返回分页对象。如果为false,意味着禁用分页。IDataProvider
getSort()返回排序对象。如果为false,意味禁用排序。IDataProvider
getTotalItemCount()返回数据项总数量。IDataProvider

方法详细

getData() 方法
abstract public array getData(boolean $refresh=false)
$refreshboolean是否从持久存储中重新计算。
{return}array数据提供者中当前可用的数据项列表。
源码: framework/base/interfaces.php#591 (显示) publicfunctiongetData($refresh=false);

返回当前可用数据项。

getId() 方法
abstract public string getId()
{return}string唯一ID用来区分其它数据提供者。
源码: framework/base/interfaces.php#570 (显示) publicfunctiongetId(); getItemCount() 方法
abstract public integer getItemCount(boolean $refresh=false)
$refreshboolean是否重新计算数据项中的数量。
{return}integer当页面数据项的数量。
源码: framework/base/interfaces.php#578 (显示) publicfunctiongetItemCount($refresh=false);

返回当页面数据项的数量。 这相当于count($provider->getData())。 当pagination设置为false,它与totalItemCount返回同样的值。

getKeys() 方法
abstract public array getKeys(boolean $refresh=false)
$refreshboolean是否应该重新计算
{return}array键值对应的data列表。 数组中的每一个键唯一对应data中每一个数据项。
源码: framework/base/interfaces.php#598 (显示) publicfunctiongetKeys($refresh=false);

Returns the key values associated with the data items.

getPagination() 方法
abstract public CPagination getPagination()
{return}CPagination分页对象。如果为false,意味着禁用分页。
源码: framework/base/interfaces.php#606 (显示) publicfunctiongetPagination(); getSort() 方法
abstract public CSort getSort()
{return}CSort排序对象。如果为false,意味禁用排序。
源码: framework/base/interfaces.php#602 (显示) publicfunctiongetSort(); getTotalItemCount() 方法
abstract public integer getTotalItemCount(boolean $refresh=false)
$refreshboolean是否重新计算数据项中的数量。
{return}integer数据项总数量。
源码: framework/base/interfaces.php#585 (显示) publicfunctiongetTotalItemCount($refresh=false);

返回数据项总数量。 当pagination设置为false,它与itemCount返回同样的值。