File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -323,10 +323,23 @@ var mv = (function () {
323323 $ ( ".bl." + classe + " input" ) . bind ( "change" , function ( e ) {
324324 var id = $ ( this ) . parent ( ) . parent ( ) . attr ( "data-layerid" ) ;
325325 var value = $ ( e . currentTarget ) . prop ( "checked" ) ;
326+ var select = $ ( "#frm-bl-visible" ) ;
327+ var currentValue = select . val ( ) ;
326328 if ( value === true ) {
327- $ ( "#frm-bl-visible option[value='" + id + "']" ) . removeAttr ( "disabled" ) ;
329+ select . find ( "option[value='" + id + "']" ) . removeAttr ( "disabled" ) ;
330+ if ( ! currentValue ) {
331+ select . val ( id ) . trigger ( "change" ) ;
332+ }
328333 } else {
329- $ ( "#frm-bl-visible option[value='" + id + "']" ) . attr ( "disabled" , "disabled" ) ;
334+ select . find ( "option[value='" + id + "']" ) . attr ( "disabled" , "disabled" ) ;
335+ if ( id === currentValue ) {
336+ var first = select . find ( "option:not(:disabled)" ) . first ( ) ;
337+ if ( first . length ) {
338+ select . val ( first . val ( ) ) . trigger ( "change" ) ;
339+ } else {
340+ select . val ( null ) . trigger ( "change" ) ;
341+ }
342+ }
330343 }
331344 } ) ;
332345 } ,
You can’t perform that action at this time.
0 commit comments