Talking about how to edit treegrid in EasyUI, easyuitreegrid

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.