From 3ccff4401e87bac9c5817d52b207b88b97f42c7a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 15 Dec 2014 23:11:48 +0100 Subject: [PATCH] Added current value to selection. --- .../controllers/_application_controller_form.js.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 127afa8c9..0aee74c14 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -1595,6 +1595,16 @@ class App.ControllerForm extends App.Controller if record['id'] is key || ( record['id'] && key && record['id'].toString() is key.toString() ) list.push record + # check if current value need to be added + if @params[ attribute.name ] + hit = false + for value in list + if value['id'].toString() is @params[ attribute.name ].toString() + hit = true + if !hit + currentRecord = App[ attribute.relation ].find( @params[ attribute.name ] ) + list.push currentRecord + # no data filter matched else App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-data no filter matched'