jui_datagrid (v0.9.1)



jui_datagrid is a helper class for jquery.jui_datagrid plugin, handles server operations (mainly through AJAX requests).

NOTE: It is just a helper class. Anyone could write custom php code to return JSON results to jquery.jui_datagrid plugin (or to perform any other action as delete, export etc).

Required: php 5+

ADODB drivers tested: mysqli, pdo_mysql, mysqlt, mysql, postgres.


GROUP BY and HAVING are not supported (at this time), neither from jui_datagrid class nor from jquery.jui_datagrid plugin.


This is a sample ajax call script to get total rows and page data:

Fetch page data from server

$db_settings = array(
'rdbms' => 'MYSQLi', // one of "MYSQLi", "MYSQL_PDO", "MYSQL", "ADODB", "POSTGRES"
'use_prepared_statements' => true, // this setting is ignored with MYSQL (as old MYSQL extension does not support prepared statements)
'pst_placeholder' => 'question_mark', // one of "question_mark" (?) or "numbered" ($1, $2 ...)
'db_conn' => null,
'db_server' => 'DB_SERVERNAME_OR_IP',
'db_name' => 'DBNAME',
'db_user' => 'DB_USER',
'db_passwd' => 'DB_PASSWORD',
'db_port' => '',
'php_adodb_driver' => 'pdo_mysql', // ADODB drivers tested: mysqli, mysqlt, mysql, pdo_mysql, postgres
'php_adodb_dsn_options_persist' => '0', // do not change if you are not sure
'php_adodb_dsn_options_misc' => '', // do not set fetchmode here, as ADODB_FETCH_ASSOC is used
'php_adodb_dsn_custom' => '',
'query_after_connection' => '', // e.g. 'SET NAMES UTF8'
'encoding' => 'utf8' // if defined, it is applied after connection to MYSQLi $conn->set_charset() or MYSQL mysql_set_charset()
"selectCountSQL" => "SQL_HERE", // CONFIGURE
"selectSQL" => "SQL_HERE", // CONFIGURE
"page_num" => $_POST['page_num'],
"rows_per_page" => $_POST['rows_per_page'],
"columns" => $_POST['columns'],
"sorting" => isset($_POST['sorting']) ? $_POST['sorting'] : array(),
"filter_rules" => isset($_POST['filter_rules']) ? $_POST['filter_rules'] : array()
$jdg = new jui_datagrid($db_settings, $page_settings, $_POST['debug_mode'] == "yes" ? true : false);
echo json_encode($jdg->get_page_data());