Multi-User Sync

Applicable to: Grid, TreeGrid, Tree, Combo, Scheduler, DataView, Chart, Form

Starting from version 1.0, dhtmlxConnector can work in multi-user mode that allows users to see each other's changes in real time.

To enable this mode you need to write additions both for the client and server sides:

Client side

1) init component with dataprocessor (if it hasn't been initialized yet)

dp = new dataProcessor("myconnector.php");
dp.init(mygrid);

2) call the setAutoUpdate() method where the input parameter is the delay between update calls

dp.setAutoUpdate(2000);

Server side

1) call the enable_live_update() method

require("../../codebase/grid_connector.php");
$grid = new GridConnector($res);
$grid->enable_live_update('actions_table');  //this line!

"actions_table" - a table in the database, which will be used for sync. data storage. It should have the following structure:

CREATE TABLE `actions_table` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dataId` int(11) NOT NULL,
  `type` varchar(255) NOT NULL,
  `user` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM;
Back to top