olton / Metro-UI-CSS

Impressive component library for expressive web development! Build responsive projects on the web with the first front-end component library in Metro Style. And now there are even more opportunities every day!
http://metroui.org.ua/
MIT License
7k stars 1.97k forks source link

Can't create Metro objects on a loop #1813

Open elpepefontana opened 2 years ago

elpepefontana commented 2 years ago

``function setSelectOptions(jsonData) {
let data = JSON.parse(jsonData); let iterate = 0; $.each(data, function(id, item){ let selectData = transformSelectData(item); let idSelect = '#form_' + iterate + ' #' + id;

    let select = Metro.getPlugin(idSelect, 'select');
    select.data(selectData);

    iterate++;
});

} ``

This piece of code throws this error 'TypeError: Cannot read property 'data' of undefined'. Is not setting up the select variable.

xscode-auto-reply[bot] commented 2 years ago

Thanks for opening a new issue. The author has been notified and will review it as soon as possible. For urgent issues and priority support, visit https://xscode.com/olton/Metro-UI-CSS or Patreon

olton commented 2 years ago

use codepen.io to create example