Check documentation for the latest version 6.0 of dhtmlxSuite Samples of Server-Side Initialization DHTMLX Docs

Samples of Server-Side Initialization

DB types

PDO ( php_pdo )

require("connector/grid_connector.php");
require("connector/db_pdo.php");
 
$res=new PDO('mysql:hostocalhost;dbname=test', $user, $pass);
 
$gridConn = new GridConnector($res,"PDO");

MySQLi ( php_mysqli )

require("connector/grid_connector.php");
require("connector/db_mysqli.php");
 
$mysqli = new mysqli($server, $user, $pass, $mysql_db); 
$gridConn = new GridConnector($mysqli,"MySQLi");

SQLite ( php_sqlite )

require("connector/grid_connector.php");
require("connector/db_sqlite.php");
if (!$db = sqlite_open('db', 0777, $sqliteerror)) {
    die($sqliteerror);
}
 
$gridConn = new GridConnector($db,"SQLite");

PostgreSQL ( php_pg )

require("connector/grid_connector.php");
require("connector/db_postgre.php");
 
$res=pg_connect("hostocalhost port=5432 dbname=mary");
 
$gridConn = new GridConnector($res,"Postgre");

Oracle ( php_oci )

require("connector/grid_connector.php");
require("connector/db_oracle.php");
 
$res = oci_connect("scott", "tiger", $db);
 
$gridConn = new GridConnector($res,"Oracle");

MSSQL ( php_mssql )

require("connector/grid_connector.php");
require("connector/db_mssql.php");
 
$res=mssql_connect('.SQLEXPRESS',"sa","1",false);
mssql_select_db("sampleDB");
 
$gridConn = new GridConnector($res,"MsSQL");

MSSQL ( php_sqlsrv )

require("connector/grid_connector.php");
require("connector/db_sqlsrv.php");
 
$conn = sqlsrv_connect( $serverName, $connectionInfo);
 
 
$gridConn = new GridConnector($conn,"SQLSrv");

MySQL ( php_mysql ) (deprecated)

require("connector/grid_connector.php");
 
$res=mysql_connect("localhost","root","");
mysql_select_db("myDatabase");
 
$gridConn = new GridConnector($res,"MySQL");

File System

require("connector/grid_connector.php");
require("connector/db_pdo.php");
 
$gridConn = new GridConnector("/var/www/test","FileSystem");
$grid->render_table("./", "id", "A,B,C,D,E,F");

Excel file

require("connector/grid_connector.php");
require("connector/db_excel.php");
 
$res=new PDO('mysql:hostocalhost;dbname=test', $user, $pass);
 
$grid = new GridConnector("some.xls", "ExcelDBDataWrapper");
$grid->render_table("A18:F83", "id", "A,B,C,D,E,F");

Component types

For other components the syntax of constructor is exactly the same, except that "Grid" in the object name is replaced with the component's name.

Grid

require("connector/grid_connector.php");
//...
$gridConn = new GridConnector($res,"MySQL");

TreeGrid

require("connector/treegrid_connector.php");
//...
$treeGridConn = new TreeGridConnector($res,"MySQL");

Tree

require("connector/tree_connector.php");
//...
$treeConn = new TreeConnector($res,"MySQL");

Combo

require("connector/combo_connector.php");
//...
$comboConn = new ComboConnector($res,"MySQL");

Scheduler

require("connector/scheduler_connector.php");
//...
$schedulerConn = new SchedulerConnector($res,"MySQL");

Form

require("connector/form_connector.php");
//...
$formConn = new FormConnector($res,"MySQL");

DataView

require("connector/dataview_connector.php");
//...
$dataConn = new DataViewConnector($res,"MySQL");

Chart

require("connector/chart_connector.php");
//...
$chartConn = new ChartConnector($res,"MySQL");

DataStore

require_once("../../connector/data_connector.php");
require_once("../../connector/db_sqlite.php");
 
if (!$db = sqlite_open('db', 0777, $sqliteerror)) {
    die($sqliteerror);
}
$storeConn = new JSONDataConnector($db,"SQLite");
Back to top