dhtmlxconnector:event_handling [DHX documentation]

PHP Connector DHTMLX

Event handling

common use

DHTMLX Connector uses events to manage Insert/Update/Delete operations.

The code below shows how to attach event:

$conn->event->attach(event_name,handlerFunc);

Parameters:

  • event_name - name of the event.
  • handlerFunc - handler function.

Handler functions get one input parameter and this parameter depends on attaching event.
In the following table you'll see a full list of events and the appropriate input parameters of handler functions.

Event Input parameter of handler function
beforeSort SortInterface Object
beforeFilter FilterInterface Object
beforeRender DataItem Object
beforeProcessing
afterProcessing
beforeInsert
beforeUpdate
beforeDelete
afterInsert
afterUpdate
afterDelete
DataAction Object
beforeOutput none

data behavior models

Starting from version 1.5, the library 'extends' OOP support and allows creating a separate class for events processing. You get the possibility to work with one class that will control all processing instead of working with separate handler functions.

class SomeBehavior{
	public function beforeRender($data){
		//some logic
	}
	... any other handlers ...
}
$conn->event->attach(new SomeBehavior());

The handlers of the model class take the same parameters as the ordinary events do.