Example in link doesn’t working … I entered “black” in ‘color’ column but nothing happened..I am expecting it will show only the rows with ‘color’ column as ‘black’
I was able to make it work but it worked only once and now its giving me the following error :
<br />
<b>Fatal error </b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in <b>C:\xampp\htdocs\Guriddo_Suito_PHP_4_8_2\php\PHPSuito\jqTreeGrid.php</b> on line <b> 5 </b> <br />
sorry missed the data..
Now data which I am getting is
{“userdata”:[],”rows”:[{“ID”:”1″,”parent”:null,”level”:0,”isLeaf”:”true”,”loaded”:”true”,”expanded”:”true”},{“ID”:”1″,”parent”:null,”level”:0,”isLeaf”:”true”,”loaded”:”true”,”expanded”:”true”}],”total”:2,”page”:1}
Hello,
I have tried both option
Option 1 : I have replaced it with $tree->setTreeModel(‘adjacency’); but still my TreeGrid is empty.
Option 2 : I tried the fresh start , I have created two new files with following content but nothing show up.
treegrid.php
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<!DOCTYPE html> <html> <head> <title>Guriddo TreeGrid PHP Demo</title> <link rel="stylesheet" type="text/css" media="screen" href="../../../css/jquery-ui.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../../css/trirand/ui.jqgrid.css" /> <style type="text"> html, body { margin: 0; /* Remove body margin/padding */ padding: 0; overflow: hidden; /* Remove scroll bars on browser window */ font-size: 75%; } </style> <script src="../../../js/jquery.min.js" type="text/javascript"></script> <script src="../../../js/trirand/i18n/grid.locale-en.js" type="text/javascript"></script> <script src="../../../js/jquery-ui.min.js" type="text/javascript"></script> <script src="../../../js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; $.jgrid.defaults.width = "700"; </script> </head> <body> <div><?php include "myfirsttreegrid.php";?></div> </body> </html> |
myfirsttreegrid.php
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
<?php ini_set("display_errors",1); require_once '/jq-config.php'; // include the driver class require_once "php/PHPSuito/DBdrivers/jqGridPdo.php"; // include the jqGrid Class require_once "php/PHPSuito/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 parent"; // set the table and primary key $tree->table = 'parent'; $tree->setPrimaryKeyId('ID'); // set tree model and table configuration $tree->setTreeModel('adjacency'); $tree->setTableConfig(array('id'=>'ID', 'parent'=>null)); // 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('ID',array("label"=>"ID", "width"=>170)); $tree->setColProperty('parent',array("label"=>"parent", "align"=>"right","width"=>90)); // and finaly set the expand column and height to auto $tree->setGridOptions(array( // set which column should act as expanded one "ExpandColumn"=>"ID", "height"=>'auto', "sortname"=>"ID", // allow automatic scrolling of the rows "scrollrows"=>true )); // enable key navigation $tree->callGridMethod('#tree', 'bindKeys'); $tree->navigator = true; $tree->setNavOptions('navigator', array("add"=>true,"edit"=>true, "del"=>true, "search"=>false, "excel"=>false)); $tree->renderTree('#tree', '#pager', true,null, null, true, true); ?> |
Thanks and Regards
Hemadri
Hello,
Thanks for the response.I will give it a try.
Started with my first grid. Data connection is OK. I can see data fetched from database in json format but still my grid is blank.
Data displayed in jason as below:
{“records”:0,”page”:0,”total”:0,”rows”:[{
“ID”:1,”parent”:”0″},{“ID”:2,”parent”:”0″}]}
Table Information :
Name : parent
Column : ID,parent
Rows : (1,0)(2,0)
Here is php code :
<?php
ini_set(“display_errors”,1);
require_once ‘../jq-config.php’;
// include the driver class
require_once ABSPATH.”php/PHPSuito/DBdrivers/jqGridPdo.php”;
// include the jqGrid Class
require_once ABSPATH.”php/PHPSuito/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 parent”;
// set the table and primary key
$tree->table = ‘parent’;
$tree->setPrimaryKeyId(‘ID’);
// set tree model and table configuration
$tree->setTreeModel(‘nested’);
$tree->setTableConfig(array(‘id’=>’ID’, ‘left’=>’null’, ‘right’=>’null’,’level’=>’0′));
// autoloading nodes
$tree->autoLoadNodes = true;
// show any error (if any ) from server
$tree->showError = true;
$tree->setColModel();
$tree->setUrl(‘mygrid.php’);
$tree->dataType = ‘json’;
// Some nice setting
$tree->setColProperty(‘ID’,array(“label”=>”ID”, “width”=>170));
$tree->setColProperty(‘parent’,array(“label”=>”parent”, “width”=>170));
// and finaly set the expand column and height to auto
$tree->setGridOptions(array(
“ExpandColumn”=>”ID”,
“height”=>”auto”,
“sortname”=>”ID”
));
$tree->renderTree(‘#tree’, ‘#pager’, true,null, null, true, true);
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top