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

hide widget #89

Closed
troolee opened this issue Mar 6, 2015 · 7 comments
Closed

hide widget #89

troolee opened this issue Mar 6, 2015 · 7 comments

Comments

@troolee
Copy link
Member

troolee commented Mar 6, 2015

@zhaoyoubing says:

I also suggest to add a "hide" or "minimize" function. With the "hide" function, the re-layout without deletion from DOM can also be implemented.

@troolee troolee added this to the v0.2.4 milestone Mar 6, 2015
@troolee troolee modified the milestones: v0.2.3, v0.2.4 Mar 9, 2015
@troolee
Copy link
Member Author

troolee commented Mar 9, 2015

Hi,

I've added a parameter detach_node to remove_widget API method. If you pass false then DOM node will not be removed from the DOM tree. So you could hide it instead.

https://github.com/troolee/gridstack.js#remove_widgetel-detach_node

@troolee troolee closed this as completed Mar 9, 2015
@rcastillog
Copy link

Hi,
I tried this functionality. I use detach mode to hide the element and then use add_widget to make it visible (I don't know if this was the correct way to do this), it works the first time (hide and show), but after next try to hide it, the widget's place was used by another widget (as it should works), but the one that should be eliminated was placed over, ignoring the occupied space, as it was placed on its own grid, it can be dragged around and placed over other ones freely.

Probably this is because I'm using add_widget and it is not the best option to show the hidden component, could you give an advice?
Thanks.

@troolee troolee reopened this Mar 18, 2015
@troolee
Copy link
Member Author

troolee commented Mar 21, 2015

Hi @rcastillog,

Can you please provide a code sample using jsfiddle or just place here?

Thank you.

@rcastillog
Copy link

Sure, in the next days I'll try to prepare a little sample and post it here. Sry for answer before, lots of job.

Greetings.

@kdietrich
Copy link
Contributor

@rcastillog Have you set up a sample?

@troolee troolee modified the milestones: v0.2.4, v0.2.5 Feb 15, 2016
@radiolips
Copy link
Member

I'm closing this out due to inactivity, but I'll provide a small response that I think will solve the problem as well.

The method makeWidget was added recently and is likely what you'll need here. If you call addWidget, it'll add the element to the DOM, and I believe you're ending up with duplicates. makeWidget, on the other hand, will add an existing element to gridstack. If you call removeWidget and pass detachNode=false, then makeWidget is likely the counterpart that will help you accomplish what you want.

Please feel free to reopen this ticket if this does not help.

@Senthilmj
Copy link

can you provide example for hide/show

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

No branches or pull requests

5 participants