This is a demo to show you using aciTree with radio-buttons. The radio flag need to be set for each item into the JSON data when
both radio and checkbox extensions are included.
By default, all items will have a radio button (if radio is missing from the JSON data).
When a radio is checked, first child from each level under the selected one will be checked by default. Also, the parents
will be checked all the way up to the root item.
All others branches will be unchecked. This functionality will break once there is a missing radio button
(with the default options set). In this way you can form radio button groups.
Note: the radio buttons on the same level (and under a parent) need to have the same field name attribute. If you need to use custom input names for each
branch, ensure you keep this in mind when you choose them.
When loading nodes, the checked/unchecked state need to be correctly set in the JSON data.
<![CDATA[
$(function(){
var log = $('.log div');
// write to log
$('#tree,#tree-combined').on('acitree', function(event, api, item, eventName, options){
if (api.isItem(item)){
log.prepend('
‘ + eventName + ‘ [‘ + api.getId(item) + ‘]’);
} else {
log.prepend(‘
‘ + eventName + ‘ [tree]’);
}
});
$(‘.clear_log’).click(function(){
$(‘.log div’).html(”);
return false;
});
});
]]>
<![CDATA[
$(function() {
$('script.code').each(function() {
$(this).before('
');
$(this).prev('div').find('pre').text($(this).html());
});});
]]>