jsTree 复选框 ajax 请求,已选中
有没有办法在 jsTree 中使用 ajax 请求更新选定的复选框?
我找不到任何想法如何执行此操作,如何在单击或取消单击复选框时调用事件或回调函数。
另外,我找不到任何如何在页面加载时使用选定值更新复选框树的想法。
感谢您的回答:)
Is there a way to update selected checkbox with ajax request in jsTree?
I cant find any ideas how to do this, how to call an event or calback function on checkbox click or unclick.
Also I cant find any ideas how to update checkbox tree with selected values on page load.
Thanks for your answers :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在使用 JSON_DATA 从数据源加载时填充复选框,无论是否使用 ajax,只需将
"class": "jstree-checked"
添加到"attr"
对象对于该节点。这将被添加到要捕获复选框选中/取消选中的事件,只需绑定到“check_node”或“uncheck_node”事件,例如,
如果您使用 jstree 网站上的版本 1.0rc2,我会从项目下载更新的开发版本页面:http://code.google.com/p/jstree/source/list
在过去的几天里,我一直在修改 jstree(试图找出许多相同的问题),并且“check_node”事件在 1.0rc2 中肯定不起作用。
当与“cookies”插件结合使用时,“jstree-checked”类似乎也存在一些奇怪的问题,根据cookie插件是在复选框插件之前还是之后添加,不同的行为进一步复杂化。不过,在最新的开发版本中,一切似乎都运行良好。
To populate the checkbox when loading from a data source with JSON_DATA, either with or without ajax, just add
"class": "jstree-checked"
to the"attr"
object for that node. This will be added to the <li> element when the data is loaded and cause the box to be checked.To capture the event on checkbox check/uncheck, just bind to the "check_node" or "uncheck_node" event, e.g.
If you are using version 1.0rc2 which is on the jstree web site, I would download a more recent development version from the project page: http://code.google.com/p/jstree/source/list
I have been tinkering with jstree a lot in the last few days (trying to figure out many of these same issues) and the "check_node" event definitely does not work in 1.0rc2.
There also seemed to be some strange issues with the "jstree-checked" class when combined with the "cookies" plug-in as well, further complicated by different behavior depending on whether the cookies plugin was added before or after the checkbox plugin. Everything seems to work fine in the most recent development version, though.