Added option to order (searchable_)select options 'DESC'.
This commit is contained in:
parent
f1c8e3da96
commit
ad1626b405
1 changed files with 13 additions and 1 deletions
|
@ -2094,7 +2094,14 @@ class App.ControllerForm extends App.Controller
|
|||
_sortOptions: (attribute) ->
|
||||
|
||||
return if !attribute.options
|
||||
return if _.isArray( attribute.options )
|
||||
|
||||
if _.isArray( attribute.options )
|
||||
# reverse if we have to exit early, if configured
|
||||
if attribute.order
|
||||
if attribute.order == 'DESC'
|
||||
attribute.options = attribute.options.reverse()
|
||||
return
|
||||
|
||||
options_by_name = []
|
||||
for i in attribute.options
|
||||
options_by_name.push i['name'].toString().toLowerCase()
|
||||
|
@ -2109,6 +2116,11 @@ class App.ControllerForm extends App.Controller
|
|||
options_new.push ii
|
||||
attribute.options = options_new
|
||||
|
||||
# do a final reverse, if configured
|
||||
if attribute.order
|
||||
if attribute.order == 'DESC'
|
||||
attribute.options = attribute.options.reverse()
|
||||
|
||||
_addNullOption: (attribute) ->
|
||||
return if !attribute.options
|
||||
return if !attribute.nulloption
|
||||
|
|
Loading…
Reference in a new issue