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 changes of each other in real time.
To enable mode you need to write additions both to client- and server-sides:
client-side
- init component with dataprocessor (if it hasn't initialized yet)
dp = new dataProcessor("myconnector.php"); dp.init(mygrid);
- call setAutoUpdate() method where input parameter is delay between update calls
dp.setAutoUpdate(2000);
server-side
- call enable_live_update() method
require("../../codebase/grid_connector.php"); $grid = new GridConnector($res); $grid->enable_live_update('actions_table'); //this line!
actions_table - table in database, which will be used for sync. data storage.
It needs to 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;