ClientMemoryDataSource
extends DataSourceBase
in package
The client-memory data source for the Table widget.
Table of Contents
- $data : array<string|int, mixed>
- $keyColumn : string
- $offset : int
- construct() : mixed
- Class constructor.
- getAllRecords() : mixed
- Returns all records in the data source.
- getCount() : int
- Returns a total number of records in the data source.
- getRecords() : array<string|int, mixed>
- Return records from the data source.
- initRecords() : mixed
- Initializes records in the data source.
- purge() : mixed
- Removes all records from the data source.
- readRecords() : array<string|int, mixed>
- Returns a set of records from the data source.
- reset() : mixed
- Rewinds the the data source to the first record.
- searchRecords() : mixed
- Identical to getRecords except provided with a search query.
Properties
$data
protected
array<string|int, mixed>
$data
= []
Keeps the data source data.
$keyColumn
protected
string
$keyColumn
Specifies a name of record's key column
$offset
protected
int
$offset
= 0
Internal record offset
Methods
construct()
Class constructor.
public
construct([string $keyColumn = 'id' ]) : mixed
Parameters
- $keyColumn : string = 'id'
-
Specifies a name of the key column.
Return values
mixed —getAllRecords()
Returns all records in the data source.
public
getAllRecords() : mixed
This method is specific only for the client memory data sources.
Return values
mixed —getCount()
Returns a total number of records in the data source.
public
getCount() : int
Return values
int —getRecords()
Return records from the data source.
public
getRecords(int $offset, int $count) : array<string|int, mixed>
Parameters
- $offset : int
-
Specifies the offset of the first record to return, zero-based.
- $count : int
-
Specifies the number of records to return.
Return values
array<string|int, mixed> —Returns the records. If there are no more records, returns an empty array.
initRecords()
Initializes records in the data source.
public
initRecords(array<string|int, mixed> $records) : mixed
The method doesn't replace existing records and could be called multiple times in order to fill the data source.
Parameters
- $records : array<string|int, mixed>
-
Records to initialize in the data source.
Return values
mixed —purge()
Removes all records from the data source.
public
purge() : mixed
Return values
mixed —readRecords()
Returns a set of records from the data source.
public
readRecords([int $count = 10 ]) : array<string|int, mixed>
Parameters
- $count : int = 10
-
Specifies the number of records to return.
Return values
array<string|int, mixed> —Returns the records. If there are no more records, returns an empty array.
reset()
Rewinds the the data source to the first record.
public
reset() : mixed
Use this method with the readRecords() method.
Return values
mixed —searchRecords()
Identical to getRecords except provided with a search query.
public
searchRecords(mixed $query, mixed $offset, mixed $count) : mixed
Parameters
- $query : mixed
- $offset : mixed
- $count : mixed