简体   繁体   中英

How to select a disabled node in jstree?

i can select a node and disable them. But after them i can't click on the the disabled node for enable them.

how can i get the selected node id, when it's disabled and not selecable?

to enable i can use this code: $("#jstree").jstree().enable_node(node.id);

I hope you can help me with my problem. If you need any further information about what I want to get or if anything is not clear, I am happy to explain it to you in more detail

Best regards!

You can use contextmenu plugin and enable/disable nodes with right click menu items.
Like this .

$( function() {
  $( "#jstree" ).jstree( {
    plugins: [ "contextmenu" ],
    "contextmenu": {
      "items": function( $node ) {
        return {
          "Enable": {
            "label": "Enable",
            "action": function( obj ) {
              $( "#jstree" ).jstree( "enable_node", $node );
            }
          },
          "Disable": {
            "label": "Disable",
            "action": function( obj ) {
              $( "#jstree" ).jstree( "disable_node", $node );
            }
          }
        };
      }
    }
  } );
} );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM