jOrgChart icon indicating copy to clipboard operation
jOrgChart copied to clipboard

Redrawing on collapse

Open cooperbradley33 opened this issue 13 years ago • 5 comments

Hi

I'm not much of a programmer, but it would be very helpfull if the graph were to be redrawn on collapse, in order to make a better use of the available space on the container.

For example, my initial tree is very wide, but if the user collapses a few nodes the diagram should redraw to use less space

Thanks!

cooperbradley33 avatar Apr 20 '12 17:04 cooperbradley33

The old version can do this. Now the node div uses style visibility instead of display. As we know visibility would use the space even it's set to hidden while display:none will absolutely take out the space.

lahvey avatar Apr 26 '12 03:04 lahvey

I have solution but can't commit the changes.

lahvey avatar Apr 26 '12 03:04 lahvey

Could you write the changes here or are they too extensive? It would be great if display or visibility toggle would be an option...

group131 avatar May 04 '12 09:05 group131

I'll accept a pull request that gives an option to ignores/respects whitespace left by collapsed nodes :) For now here's the version that will collapse into whitespace left by collapsed nodes.

https://github.com/wesnolte/jOrgChart/tree/9763085df24d0507636100e7919d6530391e62c6

wesnolte avatar May 07 '12 10:05 wesnolte

I had the same requirement and fixed it in this way:

Changed all occurences of .css('visibility', 'hidden') to .addClass('row-hidden') Also changed .css('visibility', '') to .removeClass('row-hidden')

Added this to the LESS file:

.row-hidden{
    //visibility:hidden;  //the original setting - use this to maintain the layout on open/close
    display:none;         //mine, to make it expand and contract when opening/closing a branch
}

couraud avatar Sep 05 '12 17:09 couraud