Skip to content

Commit 4965c0f

Browse files
author
Cerem Cem ASLAN
committed
search-term is set as "selected key" if there is no error
1 parent 45dc7bb commit 4965c0f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

components/dropdown/index.ls

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ Ractive.components['dropdown'] = Ractive.extend do
280280
'_add': (ctx) ->
281281
c.button = ctx.component
282282
sleep 10, -> dd.dropdown 'show'
283-
err <~ @fire \add, c, @get \search-term
283+
newKey = @get \search-term
284+
err <~ @fire \add, c, newKey
284285
# dropdown should only be closed if there is
285286
# no error returned
286287
unless err
@@ -289,6 +290,10 @@ Ractive.components['dropdown'] = Ractive.extend do
289290
@set \search-term, ''
290291
# clear the dropdown search field
291292
$('.ui.dropdown').find(".search").val("")
293+
<~ set-immediate
294+
dd.dropdown 'set selected', newKey
295+
dd.dropdown 'refresh'
296+
292297
data: ->
293298
'search-fields': <[ description ]>
294299
'search-term': ''
@@ -313,5 +318,4 @@ Ractive.components['dropdown'] = Ractive.extend do
313318
'selected-key': null
314319
'selected-name': null
315320
'load-first': 100
316-
317-
'listen-external': yes # listen external key changes by default
321+
'listen-external': yes # listen external key changes by default

0 commit comments

Comments
 (0)