Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New function for collapsing/expanding a split panel #27

Closed
tFaster opened this issue Dec 11, 2015 · 15 comments
Closed

New function for collapsing/expanding a split panel #27

tFaster opened this issue Dec 11, 2015 · 15 comments

Comments

@tFaster
Copy link

tFaster commented Dec 11, 2015

I would like to see an enhancement to be able to collapse a split panel.
Essentially 'collapse()' would set the width (or height) to zero and the panel next to it to 100%.
A call to 'expand()' would bring back the gutter to the last state.
Collapse should also be available when min-size is not 0.

@nathancahill
Copy link
Owner

Yeah, right now nothing is returned from calling Split(). I think a Split instance should be returned, with methods like .destroy(), .collapse(n), .expand(n) where n is the zero indexed pane number.

@fabien
Copy link

fabien commented Dec 12, 2015

+1

2 similar comments
@gsanta
Copy link

gsanta commented Dec 15, 2015

+1

@tarr11
Copy link

tarr11 commented Dec 16, 2015

+1

@devmondo
Copy link

+1
this is really important it is blocking us now from using this cool plugin, as sometimes we really want to hide one pane completely or destroy the whole split

@glen-anderson
Copy link

+1

@PAEz
Copy link

PAEz commented Jan 8, 2016

One of the simpler ways to handle this is to make a click event for the splitter handle and let them handle it.
I wasnt sure the best way to do this (not great at dom specifics and still learning this code) so I just checked to see if you actually dragged and if not then on mouse/touch up, click.
Here's an example of the idea....
http://plnkr.co/edit/ndQdCPAiZ7t6lDA32m4i?p=preview

Oh, and I added an updateOffset to the pairs, so you can do whatever.

@argonautical
Copy link

+1

2 similar comments
@nitinsurana
Copy link

+1

@nirsharonclick
Copy link

+1

@naivefun
Copy link

+2

@tardhinata
Copy link

+10

@2silver
Copy link

2silver commented Apr 12, 2016

+1

@2silver 2silver mentioned this issue Apr 12, 2016
@gsprs
Copy link

gsprs commented Apr 13, 2016

+1

@nathancahill
Copy link
Owner

Thanks everyone. I went ahead an implemented something similar, with a few more features in this release. The API now works like this:

var instance = Split([], ...)
instance.collapse(0)
instance.collapse(1)

where 0 and 1 are the indexes for the elements in the split.

Additionally, it's possible to update the sizes now:

instance.setSizes([10, 40, 50])

And destroy the the instance altogether:

instance.destroy()

Docs are updated with the new API. Please update to the latest version, v1.1.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests