logo
down
shadow

jsTree - don't select disabled child nodes with parent?


jsTree - don't select disabled child nodes with parent?

By : KKLL
Date : November 22 2020, 03:01 PM
Hope this helps My solution tested on a 1-deep tree works. I just added this function:
code :
//select parents children except disabled ones
//test on 1-deep
$("#selectionTree").on("select_node.jstree", function(evt, data) {
    var currentNode = data.node;

    //rember opened state for later
    var openedState = currentNode['state']['opened'];

    //need to open node for accruate selection       
    $('#selectionTree').jstree('open_node', currentNode);

        //get child nodes
    var children = $(this).jstree("get_children_dom", currentNode);

        //this allows selections parent nodes to deselect children (without it, there is no three-state)
    if ($("#" + currentNode['a_attr']['id'] + " > i").hasClass("jstree-undetermined")) {
      for (var i = 0; i < children.length; i++) {
        $(children[i]).jstree("deselect_node", children[i]);
      }
    }

        //loop through child nodes and select all except disabled nodes
    for (var i = 0; i < children.length; i++) {
      var obj = $.parseJSON($(children[i]).attr('data-jstree'));
      if (obj['disabled'] == true) {
        $(children[i]).jstree("deselect_node", children[i]);
      }
    }

        //return parent to closed state if was already
    if (openedState == false) {
      $(this).jstree('close_node', currentNode);
    }

});


Share : facebook icon twitter icon
jQuery and jsTree - select child nodes by class

jQuery and jsTree - select child nodes by class


By : TWA
Date : March 29 2020, 07:55 AM
To fix this issue Solution
Why do you find the solutions after you posted on SO and after hours of previous searching :)
code :
*Check*:  
$.jstree._reference('#mytree').check_node('#id-of-node'); 

*Uncheck*:
$.jstree._reference('#mytree').uncheck_node('#id-of-node');

*Toggle check*:
$.jstree._reference('#mytree').change_state('#id-of-node');
jstree jquery plugin - Get all child and sub child nodes of parent

jstree jquery plugin - Get all child and sub child nodes of parent


By : Pravin
Date : March 29 2020, 07:55 AM
seems to work fine I found a way to do this. In my case I am using xml as the datasource for the tree. I am binding the open_node event to the jstree in the following manner. Mind it that even though I am using xml, the internal structure is that of html data.
code :
// jsTree Configuration hash
var jsTreeConfig = {};

$("#demo1").jstree( jsTreeConfig )
            .bind('open_node.jstree', function( e, data ) {
                var parentObj = data.rslt.obj; // parent object
                var jstreeInstance = data.inst; // jstree instance
                $(data.rslt.obj).find("li").each( function( idx, listItem ) {
                    var child = $(listItem); // child object
                    // do Stuff with child which can be any level of hierarchy depth
                    // ...
                });
            });
Select Child nodes when parent is also selected in JSTREE

Select Child nodes when parent is also selected in JSTREE


By : mumpsimus
Date : March 29 2020, 07:55 AM
I wish this helpful for you I gave up on this Idea.. now im just doing ajax requests to load the childs and receive a json object, and from there i can see if its a file or directory, if its a directory again another request and like this i have the whole structure
How to open child node in JsTree when child nodes do not exist until parent is expanded?

How to open child node in JsTree when child nodes do not exist until parent is expanded?


By : Kevin Dudani
Date : March 29 2020, 07:55 AM
this will help I have a parent with multiple children nodes. The problem is if I want to open a specific node I call $("#jstree").jstree("open_node", $('#node_27'));. The problem is that the parent node is not open so the $('#node_27') returns an empty array. , Apparently if you want to "deep open" a node, you would need to use
code :
$("#jstree1").jstree("open_node", ['rootId','childId','childChildId','yourNodeId']);
$("#jstree1").jstree("_open_to", 'yourNodeId'); //j1_5 in your case
Jstree - load child nodes after clicking on parent (json)

Jstree - load child nodes after clicking on parent (json)


By : J.Yoe
Date : March 29 2020, 07:55 AM
help you fix your problem I want to load the child nodes of a parent node after clicking on the parent node. Because there are many childs this is the only way to keep the performance high. , Use this:
Related Posts Related Posts :
  • Add Html.BeginForm with jQuery in MVC view
  • Deselect any option from Bootstrap-Select dropdown component
  • How to crop text without removing the div element, jquery
  • Get $_GET[] from the URL with jQuery
  • JS Validate not working among forms
  • CKEDITOR setData with HTML string returns SyntaxError: Invalid or unexpected token
  • Reset the bootstrap-select using jQuery iniside a form
  • Full Calendar event time adding an hour on chrome and safari browser
  • How to check css class before running a script
  • How to determine which multiple key binding is being fired
  • KoGrid Row Selection Binding
  • Animate background-color of html5 progress element
  • show Checkbox Only if it is checked
  • Rails Dropdown menu not working / hash link not working? Maybe turbolink error?
  • what is the Jquery script to make the FIRST WORD in each sentence bold?
  • after dom loaded textbox value is undefined
  • Why jquery table columns not effected Bootstrap css
  • Why is Second Deferred not getting triggered?
  • How to set multiple attributes to the same value?
  • Tablesorter not initializing after Ajax replaces HTML
  • Listed Item no longer can Toggle. Why is that?
  • Why isn't my request getting to the server? - Works locally not on server though
  • Jquery Accordion wont open after coming back to the page with angular routing
  • jquery coloriconselectmenu with color on init
  • Expanded div runs through footer
  • Jquery hidden input select to to write value
  • jquery select options remove initial option and replace with others
  • Detect scrollTop distance with body set to 100% height
  • Is it possible to add an href attribute to autocomplete function by materialize?
  • Ajax request inside for loop
  • Making the size of elements the same with jQuery
  • jQuery Match Game
  • On Fancytree jquery plugin what is the event that occur when no data presented?
  • Send base64 image via ajax
  • How to set default uncheck all items in bootstrap table?
  • JQuery CSS selector strange behaviour, why?
  • Hover shows lower div
  • Placement of JQuery Scripts with multiple other scripts?
  • Can .attr be animated?
  • passing image to kendo popup window [Request Uri too long 414]
  • edit/add to jQuery Validate email method rules?
  • Aligning Radio buttons horizontally (in mobile)?
  • Jquery ui autocomplete searching words in random order and linking to url
  • jquery selection on a select list
  • JQuery 2.1.4 preventDefault on form submit not working
  • Hide "Load More: button in a lazy load
  • transform arrow upside down and centered when button is selected
  • Getting access to iframe contents with jquery after inspecting it with the browser
  • My jQuery isn't working properly
  • How to remove special characters from URL in jQuery?
  • Block postion fixed below accurate width of browser
  • Remove first of element pair with duplicate class. Classes have unique number for each pair
  • to align a dropdown on right of menu
  • Bootstrap 4 Beta: check which item on btn-group is checked
  • data table is not working on my table in view page in mvc
  • How to synchronyse 2 forms in the same page
  • Get values of Bootstrap-select options using jquery
  • jQuery DataTable buttons not showing when a table row is added
  • How to move image in input which is set with `background` property?
  • Materialize: ERROR TypeError: $(...).datepicker is not a function
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org