victor-valencia / bootstrap-iconpicker

A simple icon picker
https://victor-valencia.github.com/bootstrap-iconpicker/
MIT License
381 stars 138 forks source link

selectedClass not being added with custom icon set #82

Open cocowalla opened 5 years ago

cocowalla commented 5 years ago

I'm using a custom icon set, which is a subset of Font Awesome 5, and contains both "regular" and "brand" icons, so I can't use iconClass. I'm initialising the iconpicker like this:

$("#my-iconpicker").iconpicker({
    footer: false,
    header: false,
    align: "left",
    cols: 12,
    icon: "",
    iconset: {
        iconClass: "",
        iconClassFix: "",
        icons: [
            "empty",
            "far fa-globe",
            "fab fa-windows",
            "fab fa-linux",
            "far fa-desktop",
            "far fa-server"
        ]
    },
    rows: 2,
    search: false,
    selectedClass: "btn-success",
    unselectedClass: ""
});

The problem is that when selecting an icon, the btn-success class isn't being added. Note that is is added if the empty option is selected, so I believe it's related to there being spaces in the icon names.