Now, we will load data to the grid. We'll use a MySQL database "sampledb " and the table "books " in it as the data source. In the grid we will present 3 properties (title, quantity, price ).
To load data we will use the PHP platform and the dhtmlxConnector library, as this is the easiest way to implement the server-side logic for a DHTMLX-based application.
1) Make sure that your MySql, Apache servers are running and you've defined the correct directory to your app for them, otherwise the error "LoadXML" will appear.
2) Make sure that your 'ID' field in the database is set as autoincrement.
Make sure that all the includes used within the connector's script don't have any whitespaces beyond the <?php and ?> tags.
<?php require_once("codebase/connector/grid_connector.php");//includes connector file //connects to the database with the name "sampledb" $res=new PDO("mysql:dbname=sampledb;host=localhost","user","password"); $conn = new GridConnector($res); //initializes the connector object $conn->render_table("books","id","title,quantity,price"); //loads data from db
contactsGrid.load("data.php"); //takes the path to your data feed
Back to top