码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI,对treegrid进行编辑

时间:2014-07-30 12:36:15      阅读:747      评论:0      收藏:0      [点我收藏+]

标签:io   数据   cti   ar   type   table   js   ui   

主从表,从表是一个treegrid,加载完数据后,点击节点进入编辑状态。

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});
                            //将编辑框设置成可编辑

                            $(feditor.target).numberbox(‘enable‘);
                            var feditor2 = editors[2];//一行中第三个编辑框
                            $(feditor2.target).validatebox({required:true});
                        }else if(record.id == 0){//选择苹果
                            var feditor = editors[1];
                            $(feditor.target).validatebox({required:false});
                            $(feditor.target).validatebox("setValue","");
                            $(feditor.target).numberbox(‘disable‘);
                            var feditor2 = editors[2];
                            $(feditor2.target).validatebox({required:false});
                            $(feditor2.target).validatebox("setValue","");
                        }
                    },
                }
            }
        }


开启编辑状态

$(‘#rulesgrid‘).treegrid(‘beginEdit‘, index);


EasyUI,对treegrid进行编辑,布布扣,bubuko.com

EasyUI,对treegrid进行编辑

标签:io   数据   cti   ar   type   table   js   ui   

原文地址:http://my.oschina.net/chinamummy29/blog/296379

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!