require_once ABSPATH . "php/jqGridPdo.php"; // include the jqGrid Class require_once ABSPATH . "php/jqTreeGrid.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqTreeGrid instance $tree = new jqTreeGrid($conn); $tree->SelectCommand = "SELECT * FROM nested_category"; // set the table and primary key $tree->table = 'nested_category'; $tree->setPrimaryKeyId('category_id'); // set tree model and table configuration $tree->setTreeModel('nested'); $tree->setTableConfig(array('id' => 'category_id', 'left' => 'lft', 'right' => 'rgt')); // autoloading is disabled $tree->autoLoadNodes = false; // collapse all nodes (default) $tree->expandAll = true; // show any error (if any ) from server $tree->showError = true; $tree->setColModel(); $tree->setUrl('treegrid.php'); $tree->dataType = 'json'; // Some nice setting $tree->setColProperty('name', array("label" => "Name", "width" => 170)); $tree->setColProperty('price', array("label" => "Price", "width" => 90, "align" => "right")); $tree->setColProperty('qty_onhand', array("label" => "Qty", "width" => 90, "align" => "right")); $tree->setColProperty('color', array("label" => "Color", "width" => 100)); // hide the not needed fields
require_once ABSPATH . "php/jqGridPdo.php"; // include the jqGrid Class require_once ABSPATH . "php/jqTreeGrid.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqTreeGrid instance $tree = new jqTreeGrid($conn); $tree->SelectCommand = "SELECT * FROM adj_table"; // set the table and primary key $tree->table = 'adj_table'; $tree->setPrimaryKeyId('emp_id'); // set tree model and table configuration $tree->setTreeModel('adjacency'); $tree->setTableConfig(array('id' => 'emp_id', 'parent' => 'boss_id')); // autoloading is disabled $tree->autoLoadNodes = false; // collapse all nodes (default) $tree->expandAll = true; // show any error (if any ) from server $tree->showError = true; $tree->setColModel(); $tree->setUrl('treegrid.php'); $tree->dataType = 'json'; // Some nice setting $tree->setColProperty('name', array("label" => "Employee", "width" => 170)); $tree->setColProperty('salary', array("label" => "Salary", "align" => "right", "width" => 90)); // hide the not needed fields $tree->setColProperty('emp_id', array("hidden" => true)); $tree->setColProperty('boss_id', array("hidden" => true));
require_once ABSPATH . "php/jqGridPdo.php"; // include the jqGrid Class require_once ABSPATH . "php/jqTreeGrid.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqTreeGrid instance $tree = new jqTreeGrid($conn); $tree->SelectCommand = "SELECT * FROM accounts"; // set the table and primary key $tree->table = 'accounts'; $tree->setPrimaryKeyId('account_id'); // set tree model and table configuration $tree->setTreeModel('adjacency'); $tree->setTableConfig(array('id' => 'account_id', 'parent' => 'parent_id')); // autoloading is disabled $tree->autoLoadNodes = false; // collapse all nodes (default) $tree->expandAll = true; // show any error (if any ) from server $tree->showError = true; $tree->setColModel(); $tree->setUrl('treegrid.php'); $tree->dataType = 'json'; // Some nice setting $tree->setColProperty('name', array("label" => "Name", "width" => 170)); $tree->setColProperty('acc_num', array("label" => "Number", "width" => 170)); $tree->setColProperty('debit', array("label" => "Debit", "width" => 90, "align" => "right")); $tree->setColProperty('credit', array("label" => "Credit", "width" => 90, "align" => "right")); $tree->setColProperty('balance', array("label" => "Balance", "width" => 90, "align" => "right"));