ServerEventDataSource
        
        The server-event data source for the Table widget.
    
    
 class Backend\Widgets\Table\ServerEventDataSource
extends Backend\Widgets\Table\DataSourceBaseExtends
| Class | Description | 
|---|---|
| DataSourceBase | Base class for the Table widget data sources. | 
Traits
| Trait | Description | 
|---|---|
| Emitter | Adds event related features to any class. | 
Properties
            
                            
                    inherited
                
            
            
                protected
            
            
            $emitterEventCollection
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Collection of registered events.
            
                            
                    inherited
                
            
            
                protected
            
            
            $emitterEventSorted
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Sorted collection of events.
            
                            
                    inherited
                
            
            
                protected
            
            
            $emitterSingleEventCollection
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Collection of registered events to be fired once only.
inherited protected $keyColumn : string
Specifies a name of record's key column
inherited protected $offset : int
Internal record offset
Methods
public createRecord ($data, $placement, $relativeToKey) : void
Updates a record in the data source.
| Property | Type | Description | 
|---|---|---|
| $data | mixed | mixed | 
| $placement | mixed | mixed | 
| $relativeToKey | mixed | mixed | 
public deleteRecord ($key) : array
Removes a record from the data source.
| Property | Type | Description | 
|---|---|---|
| $key | mixed | mixed | 
Returns the remaining records.
public getAllRecords ()
Returns all records in the data source.
This method is specific only for the client memory data sources.
public getCount () : int
Returns a total number of records in the data source.
public getRecords (int $offset, int $count) : array
Return records from the data source.
| Property | Type | Description | 
|---|---|---|
| $offset | int | int Specifies the offset of the first record to return, zero-based. | 
| $count | int | int Specifies the number of records to return. | 
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.
| Property | Type | Description | 
|---|---|---|
| $records | array | array Records to initialize in the data source. | 
public purge ()
Removes all records from the data source.
public searchRecords ($query, $offset, $count)
Identical to getRecords except provided with a search query.
| Property | Type | Description | 
|---|---|---|
| $query | mixed | mixed | 
| $offset | mixed | mixed | 
| $count | mixed | mixed | 
public updateRecord ($key, $data) : void
Updates a record in the data source.
| Property | Type | Description | 
|---|---|---|
| $key | mixed | mixed | 
| $data | mixed | mixed | 
            
                            
                    inherited
                
            
            
                public
            
                        
            bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null, integer $priority)
                            : self
                    
                    Create a new event binding.
| Property | Type | Description | 
|---|---|---|
| $event | string | Closure | QueuedClosure | string | Closure | QueuedClosure | 
| $callback | mixed | mixed when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable | 
| $priority | integer | integer | 
            
                            
                    inherited
                
            
            
                public
            
                        
            bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null)
                            : self
                    
                    Create a new event binding that fires once only
| Property | Type | Description | 
|---|---|---|
| $event | string | Closure | QueuedClosure | string | Closure | QueuedClosure | 
| $callback | QueuedClosure | Closure | null | QueuedClosure | Closure | null When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted | 
            
                            
                    inherited
                
            
            
                public
            
                        
            construct (string $keyColumn = "id")
                    
                    Class constructor.
| Property | Type | Description | 
|---|---|---|
| $keyColumn | string | string Specifies a name of the key column. | 
            
                            
                    inherited
                
            
            
                public
            
                        
            fireEvent (string $event, array $params = [], boolean $halt = false)
                            : array | mixed | null
                    
                    Fire an event and call the listeners.
| Property | Type | Description | 
|---|---|---|
| $event | string | string Event name | 
| $params | array | array Event parameters | 
| $halt | boolean | boolean Halt after first non-null result | 
If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.
            
                            
                    inherited
                
            
            
                public
            
                        
            readRecords (integer $count = 10)
                            : array
                    
                    Returns a set of records from the data source.
| Property | Type | Description | 
|---|---|---|
| $count | integer | integer Specifies the number of records to return. | 
Returns the records. If there are no more records, returns an empty array.
inherited public reset ()
Rewinds the the data source to the first record.
Use this method with the readRecords() method.
            
                            
                    inherited
                
            
            
                public
            
                        
            unbindEvent (string | array | object $event = null)
                            : self
                    
                    Destroys an event binding.
| Property | Type | Description | 
|---|---|---|
| $event | string | array | object | string | array | object Event to destroy | 
inherited protected emitterEventSortEvents (string $eventName) : void
Sort the listeners for a given event by priority.
| Property | Type | Description | 
|---|---|---|
| $eventName | string | string | 
            
                            
                    inherited
                
            
            
                protected
            
                        
            parseEventAndPayload (mixed $event, mixed $payload = null)
                            : array
                    
                    Parse the given event and payload and prepare them for dispatching.
| Property | Type | Description | 
|---|---|---|
| $event | mixed | mixed | 
| $payload | mixed | mixed |