All the methods that ara available at jqGrid, jqEdit and jqRender classes can be used within TreeGrid class
boolean deleteTreeNode( array $data )
Delete the data into the database according the table element and tree grid model. Use this method instead of delete method in edit class
A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey Return true on success, false when the operation is not succefull
Parameters:
- array $data: associative array which key values correspond to the names in the delete command
API Tags:
Access: public
editTree( [ $summary = null], [ $params = null], [string $oper = false], [ $echo = true] )
Perform the all CRUD operations depending on the oper param send from the grid, the table element and the treegrid model If the primaryKey is not set we try to obtain it using jqGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted.
Also the method call the queryTree to perform the tree ouput
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: additional parameters that can be passed to the query
- string $oper: if set the requested oper operation is performed without to check the parameter sended from the grid.
- boolean $echo: should the result be echoed or returned
API Tags:
Access: public
array getTableConfig( )
Return the curent configuration for the model used
API Tags:
Access: public
string getTreeModel( )
Returns the currently used tree model
API Tags:
Access: public
boolean insertTreeNode( array $data )
Insert the data array into the database according to the table element and tree model.
A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey. The table config for the tree should be set.
Parameters:
- array $data: associative array which key values correspond to the names in the table.
API Tags:
See: setTableConfig Return true on succes, false otherwiese.
Access: public
mixed queryTree( [ $summary = null], [ $params = null], [boolen $echo = true] )
Return the result of the query to jqTreeGrid. Currently does not support searching.
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: - parameter values passed to the sql
- boolen $echo: if set to false return the records as object, otherwiese json encoded or xml string depending on the dataType variable
API Tags:
Access: public
mixed. renderTree( [string $tblelement = ''], [string $pager = ''], [boolean $script = true], [ $summary = null], [ $params = null], [boolean $createtbl = false], [boolean $createpg = false], [boolean $echo = true] )
Main method which do allmost everthing for the tree grid.
Construct the tree grid, perform CRUD operations, perform Query set a jqGrid method, and javascript code.
Parameters:
- string $tblelement: the id of the table element to costrict the grid
- string $pager: the id for the pager element
- boolean $script: if set to true add a script tag before constructin the grid.
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use other one this way : array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: parameters passed to the query
- boolean $createtbl: if set to true the table element is created automatically from this method. Default is false
- boolean $createpg: if set to true the pager element is created automatically from this script. Default false.
- boolean $echo: if set to false the function return the string representing the grid
API Tags:
Access: public
setTableConfig( array $aconfig )
Set the configuration fields for the model used. For the adjacency model a 'id' and 'parent' should be set For the nested model 'id', 'left', 'right' and 'level' should be set Optional fields for all models : expanded, icon, leaf, loaded
Parameters:
API Tags:
Access: public
setTreeModel( [string $model = 'nested'] )
Set the tree mode used. Can be adjacency or nested. Deafault is nested
Parameters:
API Tags:
Access: public
boolean updateTreeNode( array $data )
Update the data into the database according the table element A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey.Return true on success, false when the operation is not succefull
Parameters:
- array $data: associative array which key values correspond to the names in the table
API Tags:
Access: public