1

I have a node relation with data of MySQL, inside this data have Visible field. When i take visible by default the node of dynatree is view in black, when uncheck visible view in gray.

I use this to set to gray:

$('#tree').dynatree('getTree').getNodeByKey('ID1').data.Addclass('nodegray');

How delete this nodegray class for a previous set to nodegray?

nodegray is defined like: span.nodegraya { color:#666666;}

Shiva
  • 6,677
  • 4
  • 36
  • 61

2 Answers2

1

Finally solved the problem assigning the addClass with gray or black depend on visibility like this:

if ($visible == 0)
    $('#tree').dynatree('getTree').getNodeByKey('ID1').data.addClass = 'nodegray';
else
    $('#tree').dynatree('getTree').getNodeByKey('ID1').data.addClass = 'nodeblack';

And next redraw the tree with:

$('#tree').dynatree('getTree').redraw();
peter
  • 6,067
  • 2
  • 33
  • 44
  • if some answer is correct, [accept](https://stackoverflow.com/help/accepted-answer) it – phuclv Jul 30 '16 at 11:29
  • Also if you don't need to re-draw the whole tree, you can just redraw an individual node with `node.render()` – peter Aug 23 '17 at 21:30
0

You can remove it by selecting dynatree node class. Check the name of your dynatree nodes and do the following:

$('#tree').find('.yourNodeClass').removeClass('nodegray');
Viswanath Donthi
  • 1,791
  • 1
  • 11
  • 12