higrid.net


hgTreeGrid\hgTreeGrid
hgTreeGrid.php at line 14

Class hgTreeGrid

jqGrid
└─hgGridEdit
└─hgGridRender
└─hgTreeGrid

public abstract class hgTreeGrid
extends hgGridRender

Author:
She Yi [email protected]
Copyright:
HiGrid.net
Version:
2.1

Field Summary
boolean

$autoLoadNodes

If set to false all data is available at client side

boolean

$expandAll

Should be all nodes expanded when loaded at client

Fields inherited from hiGrid\hgGridRender
csvfile, csvsep, csvsepreplace, export, exportfile, inlineNav, navigator, pdffile, sharedAddOptions, sharedDelOptions, sharedEditOptions, toolbarfilter
Fields inherited from hiGrid\hgGridEdit
add, decodeinput, del, edit, getLastInsert, mtype, serialKey, trans
Fields inherited from hiGrid\jqGrid
ExportCommand, SubgridCommand, cacheCount, customClass, customError, customFunc, dataType, datearray, debug, encoding, errorMessage, gSQLMaxRows, higridSC, jsonencode, logtofile, mongofields, mongointegers, oper, optimizeSearch, performcount, readFromXML, showError, table, version, xmlCDATA
Method Summary
void

setData(array d)

Se the tree data for future processing

void

setLeafData(array d)

Set a leaf nodes for adjacency model

void

setTreeModel(string model)

Set the tree mode used.

string

getTreeModel()

Returns the currently used tree model

void

setTableConfig(array aconfig)

Set the configuration fields for the model used.

array

getTableConfig()

Return the curent configuration for the model used

array

getLeafNodes(integer node)

Return the leaf nodes when the adjacency model is used.

protected void

getChildNodes(integer node, string order_field, boolean id)

Return all Child nodes for both methods.

protected array

getChildren(integer node_id)

Return the child nodes of a given node.

protected array

getRoots()

Return the root nodes when adjacency model.

mixed

queryTree(array summary, array params, boolen echo)

Return the result of the query to hgTreeGrid.

boolean

updateTreeNode(array data)

Update the data into the database according the table element A primaryKey should be set.

boolean

insertTreeNode(array data)

Insert the data array into the database according to the table element and tree model.

boolean

deleteTreeNode(array data)

Delete the data into the database according the table element and tree grid model.

void

editTree(array summary, array params, string oper, bool echo)

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 hiGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted.

mixed.

higridtreedisplay(string tblelement, string pager, boolean script, array summary, array params, boolean createtbl, boolean createpg, boolean echo)

Main method which do allmost everthing for the tree grid.

Methods inherited from hiGrid\hgGridRender
addCol, callGridMethod, getColModel, getGridOption, getInlineOptions, higridOP, higridsCP, higridsGO, higridsNO, inlineNavEvent, inlineNavOptions, setAutocomplete, setButtonOptions, setColModel, setDatepicker, setFilterOptions, setGridEvent, setJSCode, setNavEvent, setSelect, setSubGrid, setSubGridGrid, setUrl
Methods inherited from hiGrid\hgGridEdit
checkPrimary, delete, editGrid, getFields, getLastInsertId, getPrimaryKeyId, insert, setAfterCrudAction, setBeforeCrudAction, setPrimaryKeyId, setSuccessMsg, setTable, update
Methods inherited from hiGrid\jqGrid
__construct, addUserData, buildSearch, debugout, execute, exportToCsv, exportToExcel, exportToPdf, getDbDate, getDbTime, getGridParams, getSqlElement, getStringForGroup, getUserDate, getUserTime, logQuery, parseSql, queryForObject, queryGrid, querySubGrid, rs2excel, rs2pdf, selectLimit, sendErrorHeader, setDbDate, setDbTime, setGridParams, setPdfOptions, setUserDate, setUserTime

Field Detail

hgTreeGrid.php at line 52

autoLoadNodes

public boolean $autoLoadNodes = true

If set to false all data is available at client side


hgTreeGrid.php at line 47

expandAll

public boolean $expandAll = false

Should be all nodes expanded when loaded at client


Method Detail

hgTreeGrid.php at line 58

setData

public void setData(array d)

Se the tree data for future processing


hgTreeGrid.php at line 65

setLeafData

public void setLeafData(array d)

Set a leaf nodes for adjacency model


hgTreeGrid.php at line 72

setTreeModel

public void setTreeModel(string model)

Set the tree mode used. Can be adjacency or nested. Deafault is nested


hgTreeGrid.php at line 82

getTreeModel

public string getTreeModel()

Returns the currently used tree model


hgTreeGrid.php at line 94

setTableConfig

public void 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


hgTreeGrid.php at line 107

getTableConfig

public array getTableConfig()

Return the curent configuration for the model used


hgTreeGrid.php at line 117

getLeafNodes

public array getLeafNodes(integer node)

Return the leaf nodes when the adjacency model is used. Note that the table and table configuration should be set

Parameters:
node - - the id of the node
Returns:
of the leaf nodes

hgTreeGrid.php at line 160

getChildNodes

protected void getChildNodes(integer node, string order_field, boolean id)

Return all Child nodes for both methods. The data is populated in the protected variable $res.

Parameters:
node - the id of the node
order_field - - optional order field
id - what to return - only the id of the noes or all the data of the child nodes. Deafult is false

hgTreeGrid.php at line 209

getChildren

protected array getChildren(integer node_id)

Return the child nodes of a given node. If the node is not specifies return the root nodes. Used only in adjacency model. Uses the data array

Parameters:
node_id - the id of the node

hgTreeGrid.php at line 234

getRoots

protected array getRoots()

Return the root nodes when adjacency model. Uses data array


hgTreeGrid.php at line 455

queryTree

public mixed queryTree(array summary, array params, boolen echo)

Return the result of the query to hgTreeGrid. Currently does not support searching.

Parameters:
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
params - - parameter values passed to the sql
echo - if set to false return the records as object, otherwiese json encoded or xml string depending on the dataType variable

hgTreeGrid.php at line 477

updateTreeNode

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 hiGridDB::getPrimaryKey. Return true on success, false when the operation is not succefull

Parameters:
data - associative array which key values correspond to the names in the table

hgTreeGrid.php at line 494

insertTreeNode

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 hiGridDB::getPrimaryKey. The table config for the tree should be set.

See Also:
Return true on succes, false otherwiese.
Parameters:
data - associative array which key values correspond to the names in the table.

hgTreeGrid.php at line 558

deleteTreeNode

public boolean deleteTreeNode(array data)

Delete the data into the database according the table element and tree grid model. A primaryKey should be set. If the key is not set It can be obtained from hiGridDB::getPrimaryKey Return true on success, false when the operation is not succefull

Parameters:
data - associative array which key values correspond to the names in the delete command

hgTreeGrid.php at line 621

editTree

public void editTree(array summary, array params, string oper, bool echo)

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 hiGridDB::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:
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
params - additional parameters that can be passed to the query
oper - if set the requested oper operation is performed without to check the parameter sended from the grid.

hgTreeGrid.php at line 691

higridtreedisplay

public mixed. higridtreedisplay(string tblelement, string pager, boolean script, array summary, array params, boolean createtbl, boolean createpg, boolean echo)

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:
tblelement - the id of the table element to costrict the grid
pager - the id for the pager element
script - if set to true add a script tag before constructin the grid.
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
params - parameters passed to the query
createtbl - if set to true the table element is created automatically from this method. Default is false
createpg - if set to true the pager element is created automatically from this script. Default false.
echo - if set to false the function return the string representing the grid

higrid.net