ソースを参照

clean up select2 options fix

CauseFX 4 年 前
コミット
5a3ba293a2
3 ファイル変更1 行追加12 行削除
  1. 0 11
      js/custom.js
  2. 0 0
      js/custom.min.js
  3. 1 1
      js/functions.js

+ 0 - 11
js/custom.js

@@ -252,17 +252,6 @@ function pageLoad(){
       },
       midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
     });
-    // select2 clear fix
-	var isClearClicked = false;
-	// trap these events
-	$('.select2-multiple').on('select2:opening', function(e) {
-		if (window['isClearClicked']) {
-			e.preventDefault();
-			window['isClearClicked'] = false;
-		}
-	}).on('select2:unselect', function(e) {
-		window['isClearClicked'] = true;
-	});
 
 }
 /* ===== Sidebar ===== */

ファイルの差分が大きいため隠しています
+ 0 - 0
js/custom.min.js


+ 1 - 1
js/functions.js

@@ -1136,7 +1136,7 @@ function buildFormItem(item){
 		case 'select2':
             var select2ID = (item.id) ? '#'+item.id : '.'+item.name;
             let settings = (item.settings) ? item.settings : '{}';
-            return smallLabel+'<select class="m-b-10 '+extraClass+'"'+placeholder+value+id+name+disabled+type+label+attr+' multiple="multiple" data-placeholder="">'+selectOptions(item.options, item.value)+'</select><script>$("'+select2ID+'").select2('+settings+');</script>';
+            return smallLabel+'<select class="m-b-10 '+extraClass+'"'+placeholder+value+id+name+disabled+type+label+attr+' multiple="multiple" data-placeholder="">'+selectOptions(item.options, item.value)+'</select><script>$("'+select2ID+'").select2('+settings+').on("select2:unselecting", function() { $(this).data("unselecting", true); }).on("select2:opening", function(e) { if ($(this).data("unselecting")) { $(this).removeData("unselecting");  e.preventDefault(); } });</script>';
 			break;
 		case 'switch':
 		case 'checkbox':

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません