var requestUrl = "/Request/Fork.ashx?action=Check"&temp=" + new Date(); grid = $("#maingrid").ligerGrid({ height: '100%', columns: [ { display: 'parent_id', name: 'parent_id', width: 110 , hide: true }, { display: 'SKU', name: 'User_code', width: 150 }, ], pageSize: 10 , width: '99.9%', columnWidth: 100, isScroll: true, frozen: true, pageSizeOptions: [10,20, 40, 50, 100], url: requestUrl, showTitle: false, rownumbers: false, // alternatingRow: false, tree: { columnName: 'User_code' }, //以树形显示的字段id ,或者name值也可以 onAfterShowData: function() { //var l = $(".l-grid-tree-link-open").length; //for (var i = l - 1; i >= 0; i--) // $(".l-grid-tree-link-open")[i].click(); collapseAll(); }, checkbox: false, isScroll: true, autoCheckChildren: false, one rror: function (a, b) { alert("错误的请求"); } });
在使用 ligerui的 表格 Tree中 首次加载没问题,查询后显示
Uncaught TypeError: p.tree.isParent is not a function
at $.ligerui.controls.Grid._getTreeCellHtml (VM10446 ligerui.all.js:12085)
定位到JS中可见 p.tree.isParent,
通过 log 发现 JSON.stringify(p.tree) 具体内容,发现需要在 tree: { columnName: 'User_code' ,isExtend:true,"childrenName":"children",},
然后JS 修改:
var isParent = (p.tree.isParent == undefined ? function (rowData) { var exist = p.tree.childrenName in rowData; return exist; } : p.tree.isParent(rowdata)); //原始