Talking about how to edit treegrid in EasyUI, easyuitreegrid
Master/Slave table. The slave table is a treegrid. After loading the data, click the node to enter the editing status.
Copy codeThe Code is as follows:
Columns :[[{
Title: "ID ",
Field: "id ",
Hidden: true
},{
Field: "pid ",
Hidden: true
},{
Title: "AAA ",
Field: "aaa ",
Width: 70,
Align: "center ",
Halign: "center"
},{
Title: "BBB ",
Field: "bbb ",
Width: 70,
Align: "center ",
Halign: "center ",
Editor :{
Type: "combobox ",
Options :{
Data :[{
"Id": 0,
"Text": "apple"
},{
"Id": 1,
"Text": "Li Zi"
}],
ValueField: 'id ',
TextField: 'text ',
Editable: false,
// Required: true,
PanelHeight: "auto ",
MissingMessage: "select fruit ",
OnSelect: function (record ){
// EditingId is the id of the row in the editing status.
Var editors = $ ('# grid'). datagrid ('geteditor', $ (' # editingid'). val ());
If (record. id = 1) {// select a pear
Var feditor = editors [1]; // The second edit box in a row
// Set the edit box to required
Certificate (feditor.tar get). validatebox ({required: true });
// Set the edit box to editable
Certificate (feditor.tar get). numberbox ('enable ');
Var feditor2 = editors [2]; // The third edit box in a row
Certificate (feditor2.tar get). validatebox ({required: true });
} Else if (record. id = 0) {// select Apple
Var feditor = editors [1];
Certificate (feditor.tar get). validatebox ({required: false });
Certificate (feditor.tar get). validatebox ("setValue ","");
Certificate (feditor.tar get). numberbox ('disable ');
Var feditor2 = editors [2];
Certificate (feditor2.tar get). validatebox ({required: false });
Certificate (feditor2.tar get). validatebox ("setValue ","");
}
},
}
}
}
Enable Edit status
Copy codeThe Code is as follows:
$ ('# Rulesgrid'). treegrid ('ineinedit ', index );
The above is the method for editing treegrid in EasyUI. I hope you will like it.