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(); //顯示修改窗體