Connecting to Database

The same as any other data-driven component dataview can load and save data by means of connectors.

Client-side Initialization

//index.html
var myDataView = new dhtmlXDataView("someContainer"); // initializes DataView
...
myDataView.load("php/data.php");
var myDP = new dataProcessor("php/data.php"); // initializes dhtmlxDataProcessor
myDP.init(myDataView);

Server-side Initialization

<?php
    require_once("../../../connector/dataview_connector.php");
 
    $conn = new PDO("mysql:dbname=dataview;host=localhost","root","");
 
    $data = new DataViewConnector($conn);
//table name, ID, list of properties
    $data->render_table("packages_small","Id","Package,Version,Maintainer");
?>

Related sample:  Connecting to database

Back to top