1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-14 18:55:56 +02:00

Update asmSelect so that it supports <select multiple> rather than just <select multiple=multiple>

This commit is contained in:
Ryan Cramer
2020-09-10 09:24:02 -04:00
parent 90ac2c90e9
commit df16ad5ae4
2 changed files with 4 additions and 4 deletions

View File

@@ -30,8 +30,8 @@ function initInputfieldAsmSelect($select) {
$select.asmSelect(options);
}
$(document).ready(function() {
$(".InputfieldAsmSelect select[multiple=multiple]").each(function() {
jQuery(document).ready(function($) {
$(".InputfieldAsmSelect select[multiple]").each(function() {
initInputfieldAsmSelect($(this));
});
$(document).on('reloaded', '.InputfieldAsmSelect, .InputfieldPage', function() {
@@ -39,7 +39,7 @@ $(document).ready(function() {
if($t.hasClass('InputfieldPage')) $t = $t.find('.InputfieldAsmSelect');
if(!$t.length) return;
if($t.find('.asmList').length) return;
$(this).find("select[multiple=multiple]").each(function() {
$(this).find("select[multiple]").each(function() {
initInputfieldAsmSelect($(this));
});
});

View File

@@ -1 +1 @@
function initInputfieldAsmSelect($select){var id=$select.attr("id");var options={};if(typeof ProcessWire.config=="undefined"){options={sortable:true}}else if(typeof ProcessWire.config[id]!="undefined"){options=ProcessWire.config[id]}else if(typeof ProcessWire.config["InputfieldAsmSelect"]!="undefined"){jQuery.extend(options,ProcessWire.config["InputfieldAsmSelect"])}var data=$select.attr("data-asmopt");if(typeof data!="undefined"){data=JSON.parse(data);if(data){jQuery.extend(options,data);if(typeof ProcessWire.config!="undefined"&&typeof ProcessWire.config[id]=="undefined"){ProcessWire.config[id]=options}}}$select.asmSelect(options)}$(document).ready(function(){$(".InputfieldAsmSelect select[multiple=multiple]").each(function(){initInputfieldAsmSelect($(this))});$(document).on("reloaded",".InputfieldAsmSelect, .InputfieldPage",function(){var $t=$(this);if($t.hasClass("InputfieldPage"))$t=$t.find(".InputfieldAsmSelect");if(!$t.length)return;if($t.find(".asmList").length)return;$(this).find("select[multiple=multiple]").each(function(){initInputfieldAsmSelect($(this))})})});
function initInputfieldAsmSelect($select){var id=$select.attr("id");var options={};if(typeof ProcessWire.config=="undefined"){options={sortable:true}}else if(typeof ProcessWire.config[id]!="undefined"){options=ProcessWire.config[id]}else if(typeof ProcessWire.config["InputfieldAsmSelect"]!="undefined"){jQuery.extend(options,ProcessWire.config["InputfieldAsmSelect"])}var data=$select.attr("data-asmopt");if(typeof data!="undefined"){data=JSON.parse(data);if(data){jQuery.extend(options,data);if(typeof ProcessWire.config!="undefined"&&typeof ProcessWire.config[id]=="undefined"){ProcessWire.config[id]=options}}}$select.asmSelect(options)}jQuery(document).ready(function($){$(".InputfieldAsmSelect select[multiple]").each(function(){initInputfieldAsmSelect($(this))});$(document).on("reloaded",".InputfieldAsmSelect, .InputfieldPage",function(){var $t=$(this);if($t.hasClass("InputfieldPage"))$t=$t.find(".InputfieldAsmSelect");if(!$t.length)return;if($t.find(".asmList").length)return;$(this).find("select[multiple]").each(function(){initInputfieldAsmSelect($(this))})})});