This is a bit trickier, as the expand/collapse doesn't trigger a full 
redraw - it works with the data as of the moment the draw call was 
originally made.  So if you change the img src in javascript, it gets 
rewritten when you expand/collapse.  If you change it in the DataTable, it 
doesn't take the change into account.  The end result is that you have to 
change it in the DataTable and manually trigger a redraw, which 
necessitates re-collapsing all of the nodes which should be collapsed. 
 Here's a working example: http://jsfiddle.net/asgallant/w8Ytq/1/ 

On Monday, September 24, 2012 12:37:26 AM UTC-4, selva wrote:
>
> Thank you so much for your valuable answer, and one more think i want to 
> add this chart. When i expand this nose, that + sign(image) change to - 
> sign(image) and similar to collapse on inverse process. Is it possible?
>
> On Friday, September 21, 2012 9:20:43 PM UTC+5:30, asgallant wrote:
>>
>> When you click a node a second time, it deselects the node, so when you 
>> click the node and then click the + sign, there is no selection to grab. 
>>  There are two ways to handle this:
>>
>> 1) clear the selection after a user selects the node (this happens in 
>> your + sign event handler, but not in the node itself)
>> 2) track the previously selected node, and if the current selection is 
>> empty, expand/collapse the previous node
>>
>> Also of note, your code adds another event listener to the div every time 
>> the node is clicked, which is entirely unnecessary and will slow down the 
>> application if users expand and collapse a node repeatedly.  Use the jQuery 
>> #on method to assign event handlers to your + signs once.  Here's one way 
>> of doing it: http://jsfiddle.net/asgallant/w8Ytq/ 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/fkCVFiHaqZ8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to