• EasyUI treegrid 加载checked


    EasyUI treegrid  加载checked

      $(function () {
             $('#tbDictContTree').treegrid({
                 title: '数据字典目录管理',
                 iconCls: 'icon-ok',
                 // 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',  180 },
                            { title: '名称', field: 'name',  180 },
    //                      { title: '是否使用', field: 'canuse1',  180 },
                            {title: '是否使用', field: 'canuse',  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',  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(); //显示修改窗体
  • 相关阅读:
    [UVA10859 放置街灯 Placing Lampposts]
    洛谷7月月赛题解(2020)
    [学习笔记]马拉车-Manacher
    [SP1026] FAVDICE
    [NOIP2013]货车运输
    [洛谷P1801]黑匣子
    [HAOI2015]树上染色
    python-第二块:time模块和datatime模块
    python-作业:员工信息表
    python-第二块,笔记整理和学习内容复习(day7)
  • 原文地址:https://www.cnblogs.com/yimeishui/p/5953352.html
Copyright © 2020-2023  润新知