EasyUI treegrid 加载checked


EasyUI treegrid  加载checked

  $(function () {
         $('#tbDictContTree').treegrid({
             title: '数据字典目录管理',
             iconCls: 'icon-ok',
             //width: 700,
             //height: 500,
             fit: true, ////自动大小
             rownumbers: true, //添加一列来显示行号
             animate: true,
             striped: true, //True 奇偶行使用不同背景色
             collapsible: true,
             //checkbox: true,
             fitColumns: true,
             url: '/ashx/Systems/tbDictContTree.ashx',
             idField: 'pid',
             treeField: 'sn',
             // collapse: false,
             // collapseAll: true,
             //SELECT  PID as pid, FID, SN as sn, Name as name, CanUse, Memo
             columns: [[
             //{ field: 'ck', checkbox: true }, //第一列显示选择
                        { title: '编号', field: 'sn', width: 180 },
                        { title: '名称', field: 'name', width: 180 },
//                      { title: '是否使用', field: 'canuse1', width: 180 },
                        {title: '是否使用', field: 'canuse', width: 80, align: 'center', formatter: function (value, row, index) {
                            if (row.canuse == "True") {
//                                return '<input type="checkbox" name="canuse" checked="checked">';
                                return '<img src="/images/checkmark.gif">';
                            }
                            else {
//                                return '<input type="checkbox" name="canuse" >';
                                return '<img src="/images/checknomark.gif">';
                            }
                        } 
                        }, 

                        { title: '备注', field: 'memo', width: 180 }
                ]],
             queryParams: { "action": "query"}    //传输参数
         });
     });

 

    function edit_dg1() {
         //选中一行,获取这一行的属性的值
         var node = $('#tbDictContTree').treegrid('getSelected');
         //判断是否选中
         if (node != null) {
             $("#textpid").val(node.pid);
             $("#textsn").val(node.sn);
             $("#textname").val(node.name);
//             $("#textcanuse").val(node.canuse);
             if (node.canuse == "True")
                 $('#textcanuse').attr('checked',true);  //checked;unchecked
             else
                 $('#textcanuse').attr('checked', false);
             $("#textmemo").val(node.memo);
             $("#dd2").show(); //显示修改窗体

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM