ClientMemoryDataSource

The client-memory data source for the Table widget.

 class Backend\Widgets\Table\ClientMemoryDataSource
extends Backend\Widgets\Table\DataSourceBase

Extends

Class Description
DataSourceBase

Base class for the Table widget data sources.

Properties

protected $data : array

Keeps the data source data.

inherited protected $keyColumn : string

Inherited from DataSourceBase

Specifies a name of record's key column

inherited protected $offset : int

Inherited from DataSourceBase

Internal record offset

Methods

public getAllRecords ()

Returns all records in the data source.

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

Returns
mixed

public getCount () : int

Returns a total number of records in the data source.

Returns
int

public getRecords (int $offset, int $count) : array

Return records from the data source.

Parameters
Property Description
$offset
int

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

$count
int

Specifies the number of records to return.

Returns
array

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

public 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
Property Description
$records
array

Records to initialize in the data source.

Returns
mixed

public purge ()

Removes all records from the data source.

Returns
mixed

inherited public construct (string $keyColumn = "id")

Inherited from DataSourceBase

Class constructor.

Parameters
Property Description
$keyColumn
string

Specifies a name of the key column.

Returns
mixed

inherited public readRecords (integer $count = 10) : array

Inherited from DataSourceBase

Returns a set of records from the data source.

Parameters
Property Description
$count
integer

Specifies the number of records to return.

Returns
array

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

inherited public reset ()

Inherited from DataSourceBase

Rewinds the the data source to the first record.

Use this method with the readRecords() method.

Returns
mixed

inherited public searchRecords ($query, $offset, $count)

Inherited from DataSourceBase

Identical to getRecords except provided with a search query.

Parameters
Property Description
$query
mixed
$offset
mixed
$count
mixed
Returns
mixed
Copyright © 2024 Winter CMS