Backend\Widgets\Table\DataSourceBase

Source: ~/modules/backend/widgets/table/DataSourceBase.php

Base class for the Table widget data sources.

Protected properties

protected string $keyColumn

Specifies a name of record's key column

protected integer $offset

Internal record offset

Public methods

public void construct(string $keyColumn='id')

Class constructor.

Parameters
  • string $keyColumn - Specifies a name of the key column.

public integer getCount()

Returns a total number of records in the data source.

public array getRecords(integer $offset, integer $count)

Return records from the data source.

Parameters
  • integer $offset - Specifies the offset of the first record to return, zero-based.
  • integer $count - Specifies the number of records to return.

public void 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.

public void purge()

Removes all records from the data source.

public array readRecords(integer $count=10)

Returns a set of records from the data source.

Parameters
  • integer $count - Specifies the number of records to return.

public void reset()

Rewinds the the data source to the first record. Use this method with the readRecords() method.

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

Identical to getRecords except provided with a search query.

Parameters
  • $query
  • $offset
  • $count