Can use jsTree radio station
5 answers
The radio button option is still not released, so you need to change the chceckbox parameter as a single choice.
bind('check_node.jstree', function(e, data) {
var currentNode = data.rslt.obj.attr("id");
$("#tree").jstree("get_checked",null,true).each
(function () {
if(currentNode != this.id){
jQuery.jstree._reference($("#tree")).uncheck_node('#'+this.id);
}
});
});
call it http://jsfiddle.net/bwTrP/1/
+2
a source to share
Using jsTree version 3.2.1 with the checkbox plugin, it is possible to emulate radio traffic behavior by manipulating the "changed" event like this:
//jstree configuration:
'checkbox': {
three_state: false, //required for the cascade none to work
cascade: 'none' //no auto all_children<->parent selection
},
//...
var resetting = false;
$('#tree').on('changed.jstree', function (e, data) {
if (resetting) //ignoring the changed event
{
resetting = false;
return;
}
if ($("#multiselect").is(':checked') == false && data.selected.length > 1) {
resetting = true; //ignore next changed event
data.instance.uncheck_all(); //will invoke the changed event once
data.instance.check_node(data.node/*currently selected node*/);
}
});
JSFiddle: Example RBButton JSTree Behavior Using Checkbox Checkbox
+1
a source to share