-
Notifications
You must be signed in to change notification settings - Fork 123
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
Change button state icon at runtime #105
Comments
I'd probably create an empty
Let me know if this presents any issues or you have any other questions |
Thx for the answer, but I may be doing something wrong, cause the feature-count-container div can't be found in the DOM. Is it created even if the initial state is not itself? (currently the initial state is 'search') |
Ah, I see. The icon element is created when you initialize the easyButton, but What framework/library handles the this is a bit hacky, but I think it should get things working for you: // switch states to attach the icon to the document
this.searchInArea.state('loaded');
// search the dom and grab a reference to the element
const featureCount = document.getElementById('feature-count-container');
// switch back to the default state
this.searchInArea.state('search'); |
Hi!
I have a button with 3 states and want to refresh the 3rd state's icon with the count of features retrieved from backend.
So far I've tried updating the button.option.state[2].icon in a watcher, but... although the components option have been changed, the button itself doesn't refresh.
Any tips on how to force that refresh?
The text was updated successfully, but these errors were encountered: