Step 1: Register for mousedown event
this.panel.show();
Ext.getDoc().on("mousedown", this.handleDocMouseDown, this);
First, we show the panel. Here it is assumed this was created previously. Second, we use Ext.getDoc() to return the current HTML document object, and then we register for the mousedown event. The second parameter, this.handleDocMouseDown, is our function we want called when this event is fired. Notice that we register for the mousedown event as opposed to the click event. This is intentional because listening for the click event will actually call this.handleDocMouseDown before your ready because a click involves both mousedown and mouseup.
Step 2: Handle the event
handleDocMouseDown : function(e) {
if (!e.within(this.panel.getEl())) {
this.panel.destroy();
Ext.getDoc().un("mousedown", this.handleDocMouseDown, this);
}
}
In our second step we first check to make sure the user didn't click anywhere in the Panel that was just displayed. If it wasn't then we destroy the panel and unregister the mousedown event.
great except what if you want that blur to cancel any operations the user has tried to click on outside of that panel.
ReplyDeletefor example if the user clicks on a button outside of the panel i want the focus to stay within the panel, it does but the button is toggled
What if the user focuses components via 'TAB' key?
ReplyDeletethanks, it helped me with floating form panel.
ReplyDeleteSuperb Information and really appreciated with it and this is fine to read and valuable. I like it.
ReplyDeleteDigital Marketing Course fees in Hyderabad
I am here for the first time. I found this blog and found it really useful and it helped me a lot, thank you.
ReplyDeleteData Analytics Training in Bangalore
Maintaining good quality content is a task, and you guys are performing this task very accurately. Winter Sale Jackets
ReplyDelete