javascript - How to hide a HTML class for a selected item in google org chart? -


i have google org chart , here source code in jsfiddle , have function

if(collapsed == 0)      {               $(function(){              $(".plus").hide();         });       } 

i have class named plus , has picture displays every node want if node has no child item want class (plus image) hidden item has no child items. in case hides nodes , don't need it.

in case person carol has no children , not need has plus image same alice

thank you

you hiding element using class selector, hide elements class present, should identify node other selector

if need hide node , have updated data itself, here how can go it.

updated fiddle : http://jsfiddle.net/w8ytq/102/

var runonce = google.visualization.events.addlistener(chart, 'ready', function() {     // set + sign event handlers     var previous;     $('#chart_div').on('click', 'div.plus', function () {         var selection = chart.getselection();         var row;         if (selection.length == 0) {             row = previous;         }         else {             row = selection[0].row;             previous = row;         }         var collapsed = chart.getcollapsednodes();         var collapse = (collapsed.indexof(row) == -1);          chart.collapse(row, collapse);         chart.setselection();          // new list of collapsed nodes         collapsed = chart.getcollapsednodes();          // set event listener recollapse nodes after redraw         var runonce2 = google.visualization.events.addlistener(chart, 'ready', function() {             google.visualization.events.removelistener(runonce2);             (var = 0; < collapsed.length; i++) {                 chart.collapse(collapsed[i], true);             }          });        var children =chart.getchildrenindexes(row);       for(var i=0;i< children.length;i++)       {           var childrenofchildren =     chart.getchildrenindexes(children[i]);           if(childrenofchildren == "")           {            var col1 = data.getvalue(children[i],0);            var col2 = data.getvalue(children[i],1);            var col3 = data.getvalue(children[i],2);             data.removerow(children[i]);            data.insertrows(children[i], [[col1, col2, col3]]);            }       }          // redraw chart account change in sign         chart.draw(data, options);      }); 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -