Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing pickers trigger change event when modal is opened with icons #69

Open
audas opened this issue Dec 5, 2017 · 1 comment
Open

Comments

@audas
Copy link

audas commented Dec 5, 2017

If we have iconpickers on a page, and subsequently load an iconpicker into a modal - then the existing iconpickers all emit a "change" event which causes icons to be inserted all over their target text fields.

It is fired when the javascript is loaded into the modal window - a requirement in my case as it is remote content for a bootstrap modal.

If you set the iconpicker to have no default icon - it does not fire.

However if you change an iconpicker to having an icon - it fires when the javascript is loaded into the modal.

@audas
Copy link
Author

audas commented Dec 5, 2017

Follow up the initiation function

Iconpicker.prototype.setIconset

Calls the select function which fires the change event on line 382

this.select(op.icon);

Commenting this out fixes the problem however it does not set the initial icon (this is the problem).
Either the initial icon needs to be set within the setIconset function or a parameter needs to be passed telling the select function not to trigger the change event. Or a global var - nope.

Am passing a second param to the select function telling it if it "setup" or "select" - only trigger the change event if it is a "select".

Works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant