-
Notifications
You must be signed in to change notification settings - Fork 413
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
bugfix: List editor behaves wrongly when calling setValue() more than once #372
Conversation
…lements on each call, apart of that, the render() method wasnt refreshing the DOM after the first call (called after by setValue)
Same as #282 |
//In case of there was a pre-existing element already placed in the DOM, then update it | ||
if (domReferencedElement) { | ||
$(domReferencedElement).replaceWith(this.el); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section seems unnecessary / not a common pattern in backbone-forms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philfreo I know... this is not a common pattern on this project, but also the List editor doesn't follow exactly the same pattern as the other editors.
Once you have inserted the form element into the DOM, a second call to listEditor.render()
instead of updating the current element, will create a new one... this one new is not possible to trap or handle in any of the available events (there's no post-render trigger or something). So, this was the most viable solution I found =).
Just had the same issue described here. Could this get merged? |
+1 |
this.setElement($el); | ||
|
||
//In case of there was a pre-existing element already placed in the DOM, then update it | ||
if (domReferencedElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check the element has actually changed ? && old != new
?
May have bearing on #517 |
It was accumulating elements on each call, apart of that, the render() method also wasn't refreshing the DOM after the first call.
The way to reproduce is simple..
The form was not only accumulating elements, but also not refreshing the view.
I hope this could reach the trunk,
Thanks,