jsTree:刷新后如何选择节点
我有一个通过 ajax 调用从服务器填充的 jQuery jsTree。当我添加一个新节点时,我会进行 ajax 调用,然后使用 tree.jstree("refresh")
调用刷新树。刷新后我想选择刚刚添加的节点。不幸的是,似乎没有可以传递给此命令的回调。有什么干净的方法可以做到这一点吗?
I have a jQuery jsTree populated from the server via an ajax call. When I add a new node I make an ajax call then make a call to refresh the tree with tree.jstree("refresh")
. After the refresh I want to select the node I just added. Unfortunately there doesn't seem to be a callback that can be passed to this command. Is there any clean way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
哦,自从这篇文章发布以来已经很久了......但仍然无法在互联网上找到答案。
因此,经过几个小时...不不不,不是这个,想出了一个解决方案
// 现在假设您从服务器端添加一个新节点,您可以通过 ajax 调用获取所创建节点的新 id,接下来您要刷新树以显示它,并选择它
oh, such a long time since this post ... and still couldn't find an answer on internet.
So after a few hours of ... no no no, not this, came up with a solutin
// now lets say that you add a new node from server side, you get the new id of the created node by an ajax call, and next you want to refresh the tree in order to display it, and also select it