davicotico / jQuery-Menu-Editor

Multilevel Menu Editor for Bootstrap 4.x (Html & Javascript code)
https://davidticona.com/demos/jQuery-Menu-Editor/
MIT License
191 stars 86 forks source link

iconClass not found #2

Closed assadnazar closed 6 years ago

assadnazar commented 6 years ago

In my environment, i get undefined for 'fa' class so my icon classes are set as 'undefined fa-icon-name' which results in no icon being showing up.

So, as a work around, i changed the jquery-menu-editor.js a bit,

iconPicker.on('change', function (e) {
        //var iconClass = (e.iconClass!=='') ? iconClass+' ' : '';
        var iconClass = "";
        if((typeof e.iconClass === 'undefined') || (e.iconClass === ''))
        {
            console.log('undefined iconclass');
            iconClass = "fa ";
        }
        $("#mnu_icon").val(iconClass+e.icon);
        console.log($("#mnu_icon").val());
        //console.log()
    });

doing this, issue is resolved but i want to know from where iconClass can be set so that issue does not show up with default setup.

davicotico commented 6 years ago

Hi. Thanks for the feedback. I changed the plugin bootstrap-iconpicker just in this line: https://github.com/davicotico/jQuery-Menu-Editor/commit/67412b19674a816873ef71b1b9563f4a186adf49#diff-1bcfcff6a0d18c3c9343964428bed00d

This change was made to be able to store the complete css class of the icon. I'm going to check the file again and perform some tests Have a good day.

davicotico commented 6 years ago

Yes, I found the bug at this line: https://github.com/davicotico/jQuery-Menu-Editor/blob/a5fc4c56d1a5babfd4a6a44df40af5a04c216b99/bs-iconpicker/js/bootstrap-iconpicker.js#L150 and was changed to: el.trigger({ type: "change", icon: 'empty', iconClass: '' });

The source code will be fixed in the next commit.

Thanks again @assadnazar

davicotico commented 6 years ago