700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > jstree禁用父节点点击_Jstree选中父节点时禁用子节点也被选中

jstree禁用父节点点击_Jstree选中父节点时禁用子节点也被选中

时间:2021-02-07 09:06:24

相关推荐

jstree禁用父节点点击_Jstree选中父节点时禁用子节点也被选中

这次给大家带来Jstree选中父节点时禁用子节点也被选中,解决Jstree选中父节点时禁用子节点也被选中的注意事项有哪些,下面就是实战案例,一起来看一下。

问题描述:

最近用jstree遇到一个问题,父节点选中时,被禁用的子节点也会选中如下

解决方案:

1、 将jstree升级到最新的版本,v3.3.4及以上就可以

2、 修改checkbox插件配置,将cascade_to_disabled设置为false(注:需要将配置脚本放jstree.min.js的后面)

$.jstree.defaults.checkbox = {

visible: true,

three_state: true,

whole_node: true,

keep_selected_style: true,

cascade: '',

tie_selection: true,

/**

* This setting controls if cascading down affects disabled checkboxes

* @name $.jstree.defaults.checkbox.cascade_to_disabled

* @plugin checkbox

*/

cascade_to_disabled : false,

cascade_to_hidden : true

};

$('#data').jstree({

'core' : {

'data' : [

{ "text" : "Root node", "children" : [

{ "text" : "Child node 1", "state": { "disabled": true } },

{ "text" : "Child node 2" },

{ "text" : "Child node 3" },

{ "text" : "Child node 4" },

{ "text" : "Child node 5" },

{ "text" : "Child node 6" }

]}

]

}

,"plugins" : [ "checkbox" ]

});

希望看了本文后您能掌握相关方法,更多精彩请关注学猫在线其它相关文章!

本文来源:/article/392452.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。