CDataProvider
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| data |
array |
Returns the data items currently available. |
CDataProvider |
| id |
string |
the unique ID that uniquely identifies the data provider among all data providers. |
CDataProvider |
| itemCount |
integer |
Returns the number of data items in the current page. |
CDataProvider |
| keys |
array |
Returns the key values associated with the data items. |
CDataProvider |
| sort |
CSort |
the sorting object. |
CDataProvider |
| totalItemCount |
integer |
Returns the total number of data items. |
CDataProvider |
Property Details
public array
getData(boolean $refresh=false)
public void
setData(array $value)
Returns the data items currently available.
public string
getId()
public void
setId(string $value)
the unique ID that uniquely identifies the data provider among all data providers.
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.
public array
getKeys(boolean $refresh=false)
public void
setKeys(array $value)
Returns the key values associated with the data items.
the pagination object. If this is false, it means the pagination is disabled.
the sorting object. If this is false, it means the sorting is disabled.
Returns the total number of data items.
When pagination is set false, this returns the same value as itemCount.
Method Details
|
abstract protected integer calculateTotalItemCount()
|
| {return} |
integer |
the total number of data items. |
Calculates the total number of data items.
|
abstract protected array fetchData()
|
| {return} |
array |
list of data items |
Fetches the data from the persistent data storage.
|
abstract protected array fetchKeys()
|
| {return} |
array |
list of data item keys. |
Fetches the data item keys from the persistent data storage.
|
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.
|
public string getId()
|
| {return} |
string |
the unique ID that uniquely identifies the data provider among all data providers. |
|
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.
|
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.
|
|
| {return} |
CPagination |
the pagination object. If this is false, it means the pagination is disabled. |
|
|
| {return} |
CSort |
the sorting object. If this is false, it means the sorting is disabled. |
|
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. |
Returns the total number of data items.
When pagination is set false, this returns the same value as itemCount.
|
public void setData(array $value)
|
| $value |
array |
put the data items into this provider. |
|
public void setId(string $value)
|
| $value |
string |
the unique ID that uniquely identifies the data provider among all data providers. |
|
public void setKeys(array $value)
|
| $value |
array |
put the data item keys into this provider. |
|
public void setPagination(mixed $value)
|
| $value |
mixed |
the pagination to be used by this data provider. This could be a CPagination object
or an array used to configure the pagination object. If this is false, it means the pagination should be disabled. |
|
public void setSort(mixed $value)
|
| $value |
mixed |
the sorting to be used by this data provider. This could be a CSort object
or an array used to configure the sorting object. If this is false, it means the sorting should be disabled. |
|
public void setTotalItemCount(integer $value)
|
| $value |
integer |
the total number of data items. |
Sets the total number of data items.
This method is provided in case when the total number cannot be determined by calculateTotalItemCount.