As mentioted into the presentastion jqTreeGrid component can support two type of tree model - nested and adjacency.
By default the component uses a nested set model.

In order to work the component in a desired manner it is recommended that the tables that hold the tree data should contain certain fields.
All of these fields and the type of the model should be set with setTableConfig and and setTreeModel php methods.

By example if we use the nested set model and our system fields in the tree table are named lft, rgt and level then the appropriate setting can look like this

<?php .... // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Create the jqTreeGrid instance $tree = new jqTreeGrid($conn); ..... // 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')); ... ?>

Having this in mind bellow we will discuss the both models.