Fixed issue #1923 - Pulldowns are not sorted currently.

This commit is contained in:
Martin Edenhofer 2018-04-05 05:15:51 +02:00
parent 49d2b040de
commit 7e91e3ca4a
2 changed files with 14 additions and 13 deletions

View file

@ -6,7 +6,7 @@ class App.UiElement.ApplicationUiElement
# skip sorting if it is disabled by config # skip sorting if it is disabled by config
return if attribute.sortBy == null return if attribute.sortBy == null
return if !attribute.options return if _.isEmpty(attribute.options)
# arrays can only get ordered # arrays can only get ordered
if _.isArray(attribute.options) if _.isArray(attribute.options)
@ -43,7 +43,7 @@ class App.UiElement.ApplicationUiElement
attribute.options[''] = '-' attribute.options[''] = '-'
@getConfigOptionList: (attribute) -> @getConfigOptionList: (attribute) ->
return if !attribute.options return if _.isEmpty(attribute.options)
selection = attribute.options selection = attribute.options
attribute.options = [] attribute.options = []
if _.isArray(selection) if _.isArray(selection)
@ -69,7 +69,7 @@ class App.UiElement.ApplicationUiElement
@getRelationOptionList: (attribute, params) -> @getRelationOptionList: (attribute, params) ->
# build options list based on relation # build options list based on relation
return if !attribute.relation return if _.isEmpty(attribute.relation)
return if !App[attribute.relation] return if !App[attribute.relation]
attribute.options = [] attribute.options = []
@ -175,7 +175,7 @@ class App.UiElement.ApplicationUiElement
# execute filter # execute filter
@filterOption: (attribute) -> @filterOption: (attribute) ->
return if !attribute.filter return if !attribute.filter
return if !attribute.options return if _.isEmpty(attribute.options)
return if typeof attribute.filter isnt 'function' return if typeof attribute.filter isnt 'function'
App.Log.debug 'ControllerForm', '_filterOption:filter-function' App.Log.debug 'ControllerForm', '_filterOption:filter-function'

View file

@ -2,14 +2,8 @@
// form // form
test('form checks', function() { test('form checks', function() {
// use unsorted order to check if the frontend is sorting correctly
App.TicketPriority.refresh([ App.TicketPriority.refresh([
{
id: 1,
name: '1 low',
note: 'some note 1',
active: true,
created_at: '2014-06-10T11:17:34.000Z',
},
{ {
id: 2, id: 2,
name: '2 normal', name: '2 normal',
@ -38,6 +32,13 @@ test('form checks', function() {
active: false, active: false,
created_at: '2014-06-10T10:17:56.000Z', created_at: '2014-06-10T10:17:56.000Z',
}, },
{
id: 1,
name: '1 low',
note: 'some note 1',
active: true,
created_at: '2014-06-10T11:17:34.000Z',
},
]) ])
App.TicketState.refresh([ App.TicketState.refresh([
@ -145,8 +146,8 @@ test('form checks', function() {
el: el, el: el,
model: { model: {
configure_attributes: [ configure_attributes: [
{ name: 'priority1_id', display: 'Priroity1', tag: 'select', relation: 'TicketPriority', null: true }, { name: 'priority1_id', display: 'Priroity1', tag: 'select', relation: 'TicketPriority', null: true, options: {} },
{ name: 'priority2_id', display: 'Priroity2', tag: 'select', multiple: true, relation: 'TicketPriority', null: true }, { name: 'priority2_id', display: 'Priroity2', tag: 'select', multiple: true, relation: 'TicketPriority', null: true, options: {} },
{ name: 'priority3_id', display: 'Priroity3', tag: 'select', relation: 'TicketPriority', null: true }, { name: 'priority3_id', display: 'Priroity3', tag: 'select', relation: 'TicketPriority', null: true },
{ name: 'escalation_times', display: 'Times', tag: 'sla_times', null: true }, { name: 'escalation_times', display: 'Times', tag: 'sla_times', null: true },
{ name: 'working_hours', display: 'Hours', tag: 'business_hours', null: true }, { name: 'working_hours', display: 'Hours', tag: 'business_hours', null: true },