jstree搜索json问题

发布于 2024-12-01 22:29:01 字数 474 浏览 0 评论 0原文

我正在使用 jstree 并且它可以正常加载 json 数据,在父节点中搜索也可以正常工作,但是当涉及到搜索最初未加载的子节点时(因为树很大并且仅加载子节点)当选择父母时)我遇到了问题。

jstree 文档 http://www.jstree.com/documentation/search 表示发送 json来自服务器的数据如下所示:[“#root_node”,“#child_node_3”]。

我的树只有两个深度:父级和子级,因此根据上面的文档,我应该只发送包含标题中包含搜索字符串的子节点的父节点,并且在搜索ajax的成功部分中我可以看到服务器正在传递所有适当的父节点,但没有显示结果我认为这与我的格式有关,我传递了父节点的 id 列表。

如果有人以前这样做过并且可以分享他们的方法或者可以提供任何可能有帮助的提示,我将非常感激!

I am using jstree and it is loading ok with json data, the searching in the parent nodes works fine as well, but when it comes to searching the child nodes which are not loaded at first (as the tree is big and children are only loaded when a parent is selected) I am experiencing a problem.

the jstree documentation http://www.jstree.com/documentation/search says to send the json data from the server like this ids: ["#root_node","#child_node_3"].

my tree is two laryers in depth only: parents and children, so based on above doc I should only send the parent node that contains that child node which has the search string in its title, and in the success section of the search ajax I can see that all the appropriate parent nodes are being passed by the server, but no results show up I am thinking it has to do with my formatting i pass a list of the id(s) of the parent nodes .

I will really appreciate if anyone had done this before and can share their approach or can just give any tips that may help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间你老了 2024-12-08 22:29:01

好吧,我找到了答案,正如 jstree 文档所解释的那样,但它是格式化的,在我的例子中,节点具有数字名称,因此基本上通过节点编号的链接传递,但每个节点旁边都有一个 # 符号,例如 [#1, #2] 因此它将加载这两个节点,并且字符串应该位于这些节点的子节点中。
我希望这可以帮助那些我花费了比我想象的时间更多的时间的人

ok I found the answer it is as the jstree document explains but it was with formatting, in my case the nodes had numeric names so basically passed in a link of node numbers but with a # sign next to each one, like [#1,#2] so it will load these two and the string should be in the children of these nodes.
I hope this helps someone I spent more time than I thought it will take

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文