jQuery MiniUI

 找回密码
 立即注册
查看: 1281|回复: 1

treeGrid新增数据,保存后怎么自动展开该节点路径 [复制链接]

Rank: 1

发表于 2022-7-1 17:57:34 |显示全部楼层
新增节点,ajax返回函数,此处reload后,下一行selectNode获取是undefinedsuccess: function (result) {
    let tgrid = mini.get("dept_treetable");
    treeGrid.reload();
    let selectNode = tgrid.getSelectedNode()
    tgrid.expandPath(selectNode);
}
但是相同的代码,在这里,selectNode能获取到,并且展开节点路径
success: function (result) {
    mini.get(loading).destroy();
    let tgrid = mini.get("areaTreeGrid");
    tgrid.reload();
    let selectNode = tgrid.getSelectedNode()
    tgrid.expandPath(selectNode);
}
准备改成这样,应该怎么获取到新增的这条数据,并且展开该节点路径
treeGrid.on("load", function (sender) {
    let selectNode = treeGrid.getSelectedNode()
    treeGrid.expandPath(selectNode);
})

Rank: 8Rank: 8

发表于 2022-7-4 09:17:49 |显示全部楼层
  1. var selectId = "";
  2. tree.on("select", function (e) {
  3.     if (e.record) {
  4.         var id = e.sender.idField;
  5.         selectId = e.record[id];
  6.     }
  7. })
  8. tree.on("load", function (sender) {

  9.     var node= tree.getNode(selectId);
  10.     tree.expandPath(node);
  11. })
复制代码

Archiver|普加软件

GMT+8, 2024-2-22 15:12 , Processed in 1.028790 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部