設置easyui treegrid 默認摺疊節點ide
在 onLoadSuccess函數中設置,遍歷全部根節點調用collapseAll.
示例:函數
$('#myTask').treegrid({ width: _w - sidebarWidth, height: _h - 90, url:'/ProjectManSys/indexTask/', //method:'get', idField:'id', treeField:'name', //toolbar: '#projectTb', autoRowHeight: true, striped:true, fitColumns: true, //scrollbarSize: 400, animate:false, rownumbers:false, columns:[[ {title:'id',field:'id',hidden:true}, {field:'name',title:'名稱',width:($(window).width() - sidebarWidth) * 0.1,formatter:onFormatterTask}, {field:'user',title:'人員',width:($(window).width() - sidebarWidth) * 0.1}, {field:'status',title:'狀態',width:($(window).width() - sidebarWidth) * 0.1}, {field:'startTime',title:'開始時間',width:($(window).width() - sidebarWidth) * 0.1}, {field:'endTime',title:'結束時間',width:($(window).width() - sidebarWidth) * 0.1}, {field:'desc',title:'描述',width:($(window).width() - sidebarWidth) * 0.1} ]], rowStyler:onTaskRowStyle, onLoadSuccess: function (row, data) { $.each(data, function (i, val) { $('#myTask').treegrid('collapseAll', data[i].id)}) } });