Nested Set is a solution for storing hierarchical data that provides very fast read access. However, updating nested set trees is more costly. Therefore this solution is best suited for hierarchies that are much more frequently read than written to. And because of the nature of the web, this is the case for most web applications.
For more detailed information on the Nested Set, read here:
http://www.sitepoint.com/article/hierarchical-data-database/2
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html


In order to work the nested set model in jqTreeGrid is requiered to have three field - left , right and level.

$tableconfigarray = array("left"=>"lft", "right"=>"rgt", "level"=>"level", "id"=>"id")

Another requirments is to have uniquie id in the table and in most cases this id is requiered to be serial (autoincremet) integer field.
For this purpose the id field should be set to. It is not neccesary to set this field if it is set as primary and serial in the tree grid definitions.

Two methods are connected with these settings

$tree->setTreeMode('nested') - sets the tree model

and

$tree->setTableConfig(array(....)); set the system fields for the tree.

By example if the table that holds the tree data is called nested_category and the id primary autoincremented field is called account_id and the other system fields have the default names, the following example prepares correct the tree grid:

<?php ... // set the table and primary key $tree->table = 'nested_category'; $tree->setPrimaryKeyId('category_id'); // set model $tree->setTreeModel('nested'); //set the table configuration $tree->setTableConfig(array('id'=>'category_id', 'left'=>'lft', 'right'=>'rgt', 'level'=>'level')); ... ?>