Documentation

ServerEventDataSource extends DataSourceBase
in package
Uses Emitter

The server-event data source for the Table widget.

Table of Contents

$emitterEventCollection  : array<string|int, mixed>
$emitterEventSorted  : array<string|int, mixed>
$emitterSingleEventCollection  : array<string|int, mixed>
$keyColumn  : string
$offset  : int
bindEvent()  : self
Create a new event binding.
bindEventOnce()  : self
Create a new event binding that fires once only
construct()  : mixed
Class constructor.
createRecord()  : void
Updates a record in the data source.
deleteRecord()  : array<string|int, mixed>
Removes a record from the data source.
fireEvent()  : array<string|int, mixed>
Fire an event and call the listeners.
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.
unbindEvent()  : self
Destroys an event binding.
updateRecord()  : void
Updates a record in the data source.
emitterEventSortEvents()  : array<string|int, mixed>
Sort the listeners for a given event by priority.

Properties

$emitterEventCollection

protected array<string|int, mixed> $emitterEventCollection = []

Collection of registered events.

$emitterEventSorted

protected array<string|int, mixed> $emitterEventSorted = []

Sorted collection of events.

$emitterSingleEventCollection

protected array<string|int, mixed> $emitterSingleEventCollection = []

Collection of registered events to be fired once only.

$keyColumn

protected string $keyColumn

Specifies a name of record's key column

Methods

bindEvent()

Create a new event binding.

public bindEvent(mixed $event, mixed $callback, mixed $priority) : self
Parameters
$event : mixed
$callback : mixed
$priority : mixed
Return values
self

bindEventOnce()

Create a new event binding that fires once only

public bindEventOnce(mixed $event, mixed $callback) : self
Parameters
$event : mixed
$callback : mixed
Return values
self

construct()

Class constructor.

public construct([string $keyColumn = 'id' ]) : mixed
Parameters
$keyColumn : string = 'id'

Specifies a name of the key column.

Return values
mixed

createRecord()

Updates a record in the data source.

public createRecord(mixed $data, mixed $placement, mixed $relativeToKey) : void
Parameters
$data : mixed
$placement : mixed
$relativeToKey : mixed
Return values
void

deleteRecord()

Removes a record from the data source.

public deleteRecord(mixed $key) : array<string|int, mixed>
Parameters
$key : mixed
Return values
array<string|int, mixed>

Returns the remaining records.

fireEvent()

Fire an event and call the listeners.

public fireEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = false ]) : array<string|int, mixed>
Parameters
$event : string

Event name

$params : array<string|int, mixed> = []

Event parameters

$halt : bool = false

Halt after first non-null result

Return values
array<string|int, mixed>

Collection of event results / Or single result (if halted)

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
Return values
mixed

unbindEvent()

Destroys an event binding.

public unbindEvent([string $event = null ]) : self
Parameters
$event : string = null

Event to destroy

Return values
self

updateRecord()

Updates a record in the data source.

public updateRecord(mixed $key, mixed $data) : void
Parameters
$key : mixed
$data : mixed
Return values
void

emitterEventSortEvents()

Sort the listeners for a given event by priority.

protected emitterEventSortEvents(string $eventName) : array<string|int, mixed>
Parameters
$eventName : string
Return values
array<string|int, mixed>

Search results