Check documentation for the latest version 6.0 of dhtmlxSuite MixedConnector DHTMLX Docs

MixedConnector

Starting from version 2.0, the library has a new connector type - MixedConnector.

The connector allows you to combine data configured by several connectors in one dataset and load it in one request instead of sending several ones that can rather decrease the number of requests to the server.

$res= new PDO("mysql:dbname=$mysql_db;host=$mysql_server",$mysql_user,$mysql_pass);
 
$data1 = new JSONDataConnector($res);
$data1->configure("country_data", "country_id", "name,full_name,type");
 
$data2 = new JSONTreeDataConnector($res);
$data2->configure("tasks_data","taskId","taskName","","parentId");
 
$conn = new MixedConnector($res);
$conn->add("countries", $data1);
$conn->add("tasks", $data2);
$conn->render(); //retrieves configured data from the server

Look up API reference, to learn more about the parameters that the methods in the snippet above take.

The retrieved data will look as in:

{
    countries: [
        {
            id: "1",
            name: "Afghanistan",
            full_name: "Islamic State of Afghanistan",
            type: "Independent State"
        },
        {
            id: "2",
            name: "Albania",
            full_name: "Republic of Albania",
            type: "Independent State"
        }
    ],
 
    tasks: {
        parent: "0",
        data: [{
            id: "1000",
            taskName: "dhtmlXGrid",
            data: [{
                id: "1001",
                taskName: "Version 1.1",
            }]
       }]
    }
}
Back to top