class DataSource

The server-side data source for the Table widget.

Properties

protected string $keyColumn
protected int $offset
protected array $data

Methods

construct(string $keyColumn = 'id')

Class constructor.

initRecords(array $records)

Initializes records in the data source.

int
getCount()

Returns a total number of records in the data source.

purge()

Removes all records from the data source.

array
getRecords(int $offset, int $count)

Return records from the data source.

getAllRecords()

Returns all records in the data source.

reset()

Rewinds the the data source to the first record.

array
readRecords(int $count = 10)

Returns a set of records from the data source.

Details

at line 30
construct(string $keyColumn = 'id')

Class constructor.

Parameters

string $keyColumn

Specifies a name of the key column.

at line 43
initRecords(array $records)

Initializes records in the data source.

The method doesn't replace existing records and could be called multiple times in order to fill the data source.

Parameters

array $records

Records to initialize in the data source.

at line 52
int getCount()

Returns a total number of records in the data source.

Return Value

int

at line 60
purge()

Removes all records from the data source.

at line 74
array getRecords(int $offset, int $count)

Return records from the data source.

Parameters

int $offset

Specifies the offset of the first record to return, zero-based.

int $count

Specifies the number of records to return.

Return Value

array

Returns the records. If there are no more records, returns an empty array.

at line 83
getAllRecords()

Returns all records in the data source.

This method is specific only for the client memory data sources.

at line 92
reset()

Rewinds the the data source to the first record.

Use this method with the readRecords() method.

at line 105
array readRecords(int $count = 10)

Returns a set of records from the data source.

Parameters

int $count

Specifies the number of records to return.

Return Value

array

Returns the records. If there are no more records, returns an empty array.