Closed 3asit closed 5 years ago
If you put a multiselect, inside a modal, and you try to set selected item at runtime it doesn't work. the function $(el).data('select') retrive nothing.
I tried with different version of metroui, and changing the order between jquery and metroui js.
i find that thre is a conflict betweent jquery and metroui, and if i call m4q(el).data('select') this work properly.
Hi, Thanks for your time. After release 4.3.x, some aspects were changed (this is due to the interaction of Metro 4 and jquery).
Now, if you use jquery, you must use a method Metro.getPlugin(el, plugin_name)
This is a changed example code for change select options at runtime.
function updateSelect(v){
m4q.get("data/"+v).then(function(response){
var select = Metro.getPlugin($("#select1"), "select");
select.data(v.indexOf("json") === -1 ? response : JSON.parse(response));
});
}
Sorry, I can’t give a more detailed answer, I’m in the hospital, some heart problems.
Thanks. First i hope you fixed most important bug about your heart!! and stay well.
Anyway i have tried from Metro version 4.2.49 to the last dev version, using Jquery version 3.4.1 or 3.3.1. Only if i exclude Jquery from the project, selected item at runtime works well
I completely fix the problem, using m4q instead of $ in the call.
Best Regards.
if "multiselect" attribute is added to the select. i get again
select is undefined
error So i am unable to set the selected items. And i include Metro 4 into page, before the jquery functionOriginally posted by @3asit in https://github.com/olton/Metro-UI-CSS/issues/1317#issuecomment-536780368