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 see changes of each other in real-time.

To enable the mode you need to write additions both fro the client- and the server-sides:

Client side

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

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

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

dp.setAutoUpdate(2000);

Server side

1) call the enable_live_update() method

<cfinclude template="../config.cfm">
<cfset grid = createObject(
  "component",
  "dhtmlXConnectors.GridConnector"
).init("#datastore#","MYSQL")>
<!--- this line! --->
<cfset grid.enable_live_update('actions_table')>

"actions_table" - table in database, which will be used for sync. data storage.

It should have the next 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