Since you're adding data to the end of your table, the selection should
stay relevant. You should be able to get the selection on the chart, and
then set it again right after the redraw. For example:

function redrawOrgChart() {
  // Remember the selection.
  var selection = orgChart.getSelection();
  // Redraw the chart.
  orgChart.draw(data, options);
  // Since we can't call setSelection before the chart is ready,
  // and the chart isn't guaranteed to be ready right after the draw call,
  // listen for the ready event and set the selection then.
  google.visualization.events.addListener(orgChart, 'ready', function() {
    orgChart.setSelection(selection);
  });
}


- Sergey


On Tue, Aug 6, 2013 at 9:40 AM, <[email protected]> wrote:

> I'm using the Organizational Chart library to create a dynamic decision
> tree.
>
> One part of the chart library is after adding a new data row, a redraw is
> necessary to apply the data to the visual graph.  When doing so, the visual
> identifier of an element selection is lost.  What I'd like to do is have
> some way to save the target select element to trigger a select event after
> redraw.
>
> DataTable.getSelection() doesn't work here, since it returns data values,
> rather than the element
>
> I can use jQuery(this), but that returns a jQuery wrapper for the target
> element, and I don't know how to extract out the data required to execute
> an event trigger.
>
> Given
>
> selectionHandler = google.visualization.events.addListener(orgChart,
> "select", selectHandler);
>
> orgChart.draw(data, {allowHtml : true, allowCollapse : true, nodeClass :
> "questionClass"});
>
> How can I capture the select target to replace `this` in the example
>
> google.visualization.events.trigger(this, 'select', null);
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to