Master-slave table, the slave table is a treegrid. After loading the data, click on the node to enter the editing state.
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" : "苹果"
}, {
"id" : 1,
"text" : "梨子"
} ],
valueField : 'id',
textField : 'text',
editable : false,
// required : true,
panelHeight : "auto",
missingMessage : "请选择水果",
onSelect : function(record) {
//editingId是进入编辑状态行的id
var editors = $('#grid').datagrid('getEditors', $('#editingId').val());
if(record.id == 1){//选择梨子
var feditor = editors[1];//一行中第二个编辑框
//将编辑框设置成必填
$(feditor.target).validatebox({required:true});
//Set the edit box to editable
var feditor2 = editors[2];//The third edit box in a line
$(feditor2.target).validatebox({required:true});
}else if(record.id == 0){//Select Apple
$(feditor.target).validatebox({required:false});
$(feditor.target).validatebox("setValue","");
$(feditor2.target).validatebox({required:false});
$(feditor2.target).validatebox("setValue","");
}
},
}
}
}
Enable editing status
Copy code
The above is the method of editing treegrid in EasyUI. I hope you will like it.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn