Extended from $.fn.datagrid.defaults, rewrite defaults with $.fn.treegrid.defaults.
Depend on
Datagrid
Usage
Copy Code code as follows:
<table id= "tt" ></table>
Copy Code code as follows:
$ (' #tt '). Treegrid ({
URL: ' Treegrid_data.json ',
Treefield: ' Name ',
columns:[[
{title: ' Task name ', field: ' Name ', width:180},
{field: ' Persons ', title: ' Persons ', width:60,align: ' Right '},
{field: ' Begin ', title: ' Begin Date ', width:80},
{field: ' End ', title: ' End Date ', width:80}
]]
});
Characteristics
Its features extend from the DataGrid, and the following are the features added for Treegrid.
Name |
Type |
Description |
Default value |
Treefield |
String |
Defines a field for a tree node. |
Null |
Animate |
Boolean |
Defines whether animation effects are displayed when a node is expanded or collapsed. |
False |
Events
Its events are extended from the DataGrid, and the following are the events added for Treegrid.
name |
parameters |
description |
onclickrow |
row |
triggers when a user clicks on a node 。 /span> |
ondblclickrow |
row |
triggers when a user double-clicks on a node 。 /span> |
onbeforeload |
row, param |
issue a load The data is triggered before the request, returning False cancels the load action. /span> |
Onloadsuccess |
Row, data |
Triggered when data is loaded successfully. |
Onloaderror |
Arguments |
triggered when data load fails. arguments parameters and jquery.ajax ' ERROR ' Method. |
onbeforeexpand |
row |
node fired before, returning False cancels the expand action. |
onexpand |
row |
triggered when node expands. /span> |
onbeforecollapse |
row |
node triggers before folding, returning False cancels the collapse action. /span> |
oncollapse |
row |
triggered when the node is collapsed. /span> |
oncontextmenu |
e, row |
triggered when right click on node 。 /span> |
onbeforeedit |
row |
trigger when user starts editing node 。 |
onafteredit |
row,changes |
when the user finishes triggered when editing. /span> |
Oncanceledit |
Row |
Triggered when the user cancels the edit node. |
Method
Name |
Parameters |
Description |
Options |
None |
Returns the options for Treegrid . |
Resize |
Options |
Set upTreegridThe size,OptionsThe parameter contains two attributes: Width : treegrid< Span lang= "en-us" Arial, ' Sans-serif '; MSO-FAREAST-LANGUAGE:ZH-CN; mso-font-kerning:0pt; Mso-fareast-font-family: The new width of the . Height : " . |
fixrowheight |
id |
adapts to the height of the specified row. |
loaddata |
data |
load data for Treegrid . /span> |
reload |
id |
reload treegrid . |
reloadfooter |
footer |
reload foot data. |
getdata |
none |
get loaded data. |
getfooterrows |
none |
get foot data. /span> |
getroot |
none |
get root node, return node to Like. /span> |
getroots |
none |
get root node, return node Data. /span> |
getparent |
id |
get parent node. /span> |
getchildren |
id |
get child nodes. /span> |
getselected |
none |
get the selected node and return it , return null . |
getselections |
none |
get all the selected nodes. /span> |
getlevel |
id |
Gets the level of the specified node. |
find |
id |
Locate the specified node and return the number of points According |
select |
id |
select node. /span> |
unselect |
id |
deselect node. /span> |
selectall |
none |
Select all nodes. /span> |
unselectall |
none |
deselect all nodes. /span> |
collapse |
id |
collapse node. /span> |
expand |
id |
expand node. /span> |
collapseall |
id |
collapse all nodes. /span> |
expandall |
id |
expand all nodes. /span> |
expandto |
id |
expand a specified node from the root. /span> |
Toggle |
Id |
Toggles the expand /collapse state of a node . |
Append |
Param |
Append nodes to the parent node. param" The parameter contains the following characteristics: Parent : dom object, the parent node to append to, or the root node if not allocated. Data : arrays, nodes of data. |
remove |
id |
remove node and its child nodes. /span> |
refresh |
id |
refresh the specified node. /span> |
beginedit |
id |
start editing node. /span> |
endedit |
id |
end Edit node. /span> |
CancelEdit |
Id |
Cancels the edit node. |
Geteditors |
Id |
Gets the editors for the specified line. Each editor has the following characteristics:
Actions: The actions that the editor can do. Target : jquery object. Field : Field name. Type : type of editor. |
Geteditor |
Options |
gets the specified editor, parameter contains two features: ID : Row node of the ID ." Field : The field name. |