EasyUI treegrid设置折叠节点(默认展开一级节点)


    $("#mainGrid").treegrid({
      fit: true,
      toolbar: "#toolbar",
      fitColumns: false,
      width: $(window).width() - 22,
      height: $(window).height() - 110,
      rownumbers: false,
      pagination: false,
      striped: true,
      idField: "id",
      treeField: "name",
      columns: [
        [
          {
            field: "name",
            title: "部门名称",
            halign: "center",
            align: "left",
            width: 350
          },
          {
            field: "createName",
            title: "创建人",
            halign: "center",
            align: "center",
            width: 300
          }
        ]
      ],
      loader: function(param, success, error) {
        ajax.getList(param, success);
      },
// 在 onLoadSuccess函数中设置,遍历所有根节点调用collapseAll. onLoadSuccess:
function(row, data) { $.each(data, function(i, val) { $("#mainGrid").treegrid("collapseAll", data[i].id); }); } });

 


免责声明!

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



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