jqTree icon indicating copy to clipboard operation
jqTree copied to clipboard

Click on a node don't uncheck again?

Open husseinkhatib opened this issue 11 years ago • 4 comments

When I click on a node is selected and highlighted , I once again click on the node is selected and highlighted again. what i need is do not selected and highlighted again the node even though i select the same node unless select another node then the previous node is un selected

Can you help me please.

husseinkhatib avatar Apr 17 '15 10:04 husseinkhatib

You could override the tree.click event:

$tree.on('tree.click', function(e) {
    e.preventDefault();

    var node = e.node;

    if ($tree.tree('isNodeSelected', node)) {
        $tree.tree('selectNode', null);
    }
    else {
        $tree.tree('selectNode', node);
    }
});

mbraak avatar Apr 17 '15 10:04 mbraak

i mean when select the same node more then one times the node highlighted first and on second click is un highlighted . So if possible to do the following: first click on the node #1, the hode is selected and highlighted then click on node #1 do not un highlighted should be stay highlighted.

husseinkhatib avatar Apr 17 '15 10:04 husseinkhatib

Sorry, my error. I think this is the solution:

$tree.on('tree.click', function(e) {
    e.preventDefault();

    $tree.tree('selectNode', e.node);
});

mbraak avatar Apr 17 '15 10:04 mbraak

Thanks, it looks fine now.

husseinkhatib avatar Apr 17 '15 10:04 husseinkhatib