【发布时间】:2011-09-02 19:59:12
【问题描述】:
我正在使用 jstree 并尝试捕获复选框状态更改事件。如何获取当前选中复选框的状态及其列表 ID?
我在这里找到的示例: Jquery Jstree checkbox events capture 工作,但我不知道如何获得节点的检查状态。如果有更好或更简单的方法,我愿意接受其他建议。
$("#demo1").bind("change_state.jstree", function (e, d) {
if ((d.args[0].tagName == "A" || d.args[0].tagName == "INS") &&
(d.inst.data.core.refreshing != true && d.inst.data.core.refreshing != "undefined"))
{
//if a checkbox or it's text was clicked,
//and this is not due to a refresh or initial load, run this code . . .
alert("list id: " +d.rslt.attr("id"));
alert("is item checked?" +"***TODO***");
}
});
谢谢。
**编辑:我让我的问题更清楚,以避免对组合插件产生任何混淆(这不是我正在做的)。我在 jstree 中启用了树复选框。 **
【问题讨论】:
-
您找到解决方案了吗?我面临同样的问题。请帮忙。