From d28cd9ffaa8829bac7eafd237e38e1d4bcf2efb7 Mon Sep 17 00:00:00 2001 From: Taka Date: Fri, 13 Nov 2020 08:03:21 +0000 Subject: [PATCH] Fixed how select2's are loaded in the User Settings dialog. --- vasl_templates/webapp/static/user_settings.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vasl_templates/webapp/static/user_settings.js b/vasl_templates/webapp/static/user_settings.js index 2b68a4c..fe450c4 100644 --- a/vasl_templates/webapp/static/user_settings.js +++ b/vasl_templates/webapp/static/user_settings.js @@ -80,7 +80,11 @@ function user_settings( on_ok, caption ) var handlers = { load_checkbox: function( $elem, val ) { $elem.prop( "checked", val?true:false ) ; }, unload_checkbox: function( $elem ) { return $elem.prop( "checked" ) ; }, - load_droplist: function( $elem, val ) { if ( val ) $elem.val( val ) ; }, + load_droplist: function( $elem, val ) { + if ( val ) { + $elem.select2( "trigger", "select", { data: { id: val } } ) ; + } + }, unload_droplist: function( $elem ) { return $elem.children(":selected").val() ; }, load_text: function( $elem, val ) { $elem.val( val ? val.trim() : "" ) ; }, unload_text: function( $elem ) { return $elem.val().trim() ; },