Mysql data to Dojo datagrid
Transferring data from MySQL to Dojo DataGrid requires a simple server side component. A recent discussion on the Dojo forums demonstrates how to format the results of MySQL queries in PHP into a format that the standard Dojo repositories understand:
// do your mysql query and get a result set
$arr = array();
while($row = mysql_fetch_object($result)){
$arr[] = $row;
}
// assuming you're running php version 5.2.x or higher
// this also assumes each row in the array has a identifer field 'id' and a field "name" in the database table which are returned from the mysql query.
$jsonStr = json_encode($arr);
echo "{'identifier':'id','label':'name','items':$jsonStr}";
Check also this comment about PHP backend for sorting and searching . And this post is for yet another PHP backend example (no grid): Bringing PHP, MySQL and Dojo together .
Plus, Dojo tests is always a useful resource. Likewise, which demonstrates dispatching and editing data in mysql database . But note : it will only work locally , and only after you have edited your username / password and point it to an existing database in an example implementation of the protocol . Also, this is for the older Grid component and has not yet been ported for the new DataGrid. However, this file is a great starting point as it shows you what functions are needed to edit the data and how to get started with them.
a source to share