-
Notifications
You must be signed in to change notification settings - Fork 411
bugfix: List editor behaves wrongly when calling setValue() more than once #372
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,16 @@ | |
| if (!this.Editor.isAsync) this.addItem(); | ||
| } | ||
|
|
||
| //Save a copy of the pre-exising element, if exists | ||
| var domReferencedElement = this.el; | ||
|
|
||
| this.setElement($el); | ||
|
|
||
| //In case of there was a pre-existing element already placed in the DOM, then update it | ||
| if (domReferencedElement) { | ||
| $(domReferencedElement).replaceWith(this.el); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this section seems unnecessary / not a common pattern in backbone-forms?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| this.$el.attr('id', this.id); | ||
| this.$el.attr('name', this.key); | ||
|
|
||
|
|
@@ -192,6 +201,7 @@ | |
| }, | ||
|
|
||
| setValue: function(value) { | ||
| this.items = []; | ||
| this.value = value; | ||
| this.render(); | ||
| }, | ||
|
|
||
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?