i know there is a plugin for jsTree named jquery.tree.checkbox.js. that make the tree node multi checkable.
i just wondered if there is a plugin to raido check the tree node? or how can i modify jquery.tree.checkbox.js to achieve that?
i know there is a plugin for jsTree named jquery.tree.checkbox.js. that make the tree node multi checkable.
i just wondered if there is a plugin to raido check the tree node? or how can i modify jquery.tree.checkbox.js to achieve that?
This can simply be done by adding the attribute
rules:{
multiple : false
}
Inside the configuration of the tree. This will make it impossible to choose multiple entries.
@Asaf s answer seems to no longer work on version 3.3.1 in 2016. You now need to set multiple
on core
:
$jstree.jstree({
core: {
multiple: false,
...
}
});
Setting multiple:false
will still allow cascading so you need to turn that off too.
version 3.3.3
$(".tree").jstree({
plugins: ["checkbox"],
core: {
data: ...,
multiple: false
},
checkbox: {
three_state: false,
cascade: "none"
}
});
The radio button option is still not released, so you have to change the chceckbox option as single select.
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);
}
});
});
refer this http://jsfiddle.net/bwTrP/1/
Using jsTree version 3.2.1 with the checkbox plugin it is possible to emulate radiobutton behaviour handling the changed event as follows:
//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: JSTree radiobutton behaviour example using checkbox plugin
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...
I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...
Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph? The array is multidimensional, with three elements in each part - and the ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.