-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CompositeView's HTML state is lost when sorting collection. #1570
Comments
from jmeas on Gitter: i think we need to overwrite the sortViews callback for CompositeView https://github.com/marionettejs/backbone.marionette/blob/master/src/marionette.compositeview.js#L3 do this https://github.com/marionettejs/backbone.marionette/blob/master/src/marionette.compositeview.js#L79 instead of this.render(); So, I'm assuming that means:
This method should be overridden to call this.renderChildren() when being accessed from a CompositeView. Making the orderChanged code not DRY seems bad. Should that logic be extracted out into a method? Or maybe an orderChanged event triggers and each type of view responds to it in a different way...? Not sure how Marionette does their inheritance elegantly. |
👍 to this change |
Haven't quite thought out the implementation yet though but I agree that compositeView shouldn't trash the surrounding template |
CompositeViews are tricky tho..... since they render into the root element by default... So this change makes sense only if you are rendering into a custom container that we can clear out. So I would say the "fix" would be to expose
as a named concept and method that a user can override |
samccone is right... although I've never used that default functionality. :) |
Would this be acceptable? |
@MeoMix problem we have is that this could be breaking now - we can't really safely assume what people would want here. My proposal would be to provide a method that one can override so that we can maintain backwards compatibility - so like @samccone said something like:
by default |
|
So the solution for now @MeoMix is going to be as @ahumphreys87 said and to provide you with a a method that can be easily overridden to change the default safe render action. |
Would my solution be acceptable for a 3.0 breaking release? I don't understand why anyone would want their outer HTML trashed for a CompositeView when providing a ChildViewContainer. I can appreciate the logic behind it being a breaking change... but really I see it the other way around. Currently what I'm working with in 2.0 is an undocumented, breaking change to my code and I'm trying to get it back to expected functionality. To say that modifying the code to bring it back to expected functionality is a breaking change... is a bit... odd.. but I do see where you guys are coming from. |
👍 to move to 2.2 |
fixed by #1645 |
I have a CompositeView with the following logic:
This logic provides the CompositeView with a nice slide-in effect when it is being shown.
The CompositeView's ChildViewContainer is able to be organized using jQuery UI's sortable functionality:
When sort is called -- the CompositeView is re-rendered which causes the transform on my panel to be lost. This is bad and unexpected! How should I fix?
Here's a video: http://screencast.com/t/hcTSyp6rGhJk
The text was updated successfully, but these errors were encountered: