PDA

View Full Version : simulate mouse click and apply button highlight



ahcnse
1 May 2015, 11:34 AM
Extjs 4.2.1
Theme: Neptune
I have a toolbar with a number of buttons.
I want to highlight a button when the app starts based on #button1.
How can I simulate a mouse click so that the focus style is applied correctly?

This code adds the focus highlight, but the style is not removed when I manually click on a second button.


button.addCls('x-btn-plain-toolbar-small-focus');

The highlight is removed if I click on the first button and then on a second button.

skirtle
1 May 2015, 10:33 PM
Couldn't you just call focus on the button?

ahcnse
2 May 2015, 9:49 AM
focus() did not highlight the button
I have created a fiddle to show the issue.
https://fiddle.sencha.com/#fiddle/m7d

skirtle
2 May 2015, 10:17 AM
You're calling focus too soon.

m7f

ahcnse
2 May 2015, 6:42 PM
calling focus in boxready did the trick
thanks