From 3c43b1d1cd7673c62230ca802e7f4354a18bb2ea Mon Sep 17 00:00:00 2001 From: Wes Vetter Date: Wed, 3 Oct 2018 09:05:04 -0700 Subject: [PATCH] Fix setValue, render in ListEditor Closes #3 --- src/editors/extra/list.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/editors/extra/list.coffee b/src/editors/extra/list.coffee index ac9d94b1..f24b2dd9 100644 --- a/src/editors/extra/list.coffee +++ b/src/editors/extra/list.coffee @@ -52,7 +52,12 @@ else if !@Editor.isAsync @addItem() + #Save a copy of the pre-exising element, if exists + domReferencedElement = @el @setElement $el + #In case of there was a pre-existing element already placed in the DOM, then update it + if domReferencedElement + $(domReferencedElement).replaceWith @el @$el.attr 'id', @id @$el.attr 'name', @key if @hasFocus @@ -148,6 +153,7 @@ #Filter empty items _.without values, undefined, '' setValue: (value) -> + @items = [] @value = value @render() return