extjs5 - fireEvent('click') not working in IE11 - Extjs -


i planning trigger click event programatically when user presses spacebar key. have been used fireevent('click') working chrome, not working ie-11. tried, dispatchevent ie throwing error: "element not support method or property dispatchevent". please follow below code.

oncustomrender: function(thisel, args){     var fetchtrigger = thisel.gettrigger('fetchid     fetchtrigger.el.on('keydown',function(e,thisel){             if (e.keycode === 32) {                  //fetchtrigger.el.fireevent('click');  //this working in chrome //not working in ie , did not throwing error.                  var evobj = document.createevent('mouseevents');                  evobj.initevent('click', true, false);                  fetchtrigger.el.dispatchevent(evobj);             }       }); } 

please in advance

first of have syntax error in code provided... calling function directly easiest (as evan said) if want keep logic in controller can fire events. else need ugly code controller first, call method...

i don't fireing events , attaching listeners on 'ext.dom.element' if don't have to. use ext elements..

here do:

oncustomrender: function(thisel, args){     var fetchtrigger = thisel.gettrigger('fetchid');     fetchtrigger.on('keydown',function(trigger, e){         if (e.keycode === 32) {             trigger.fireevent('click', trigger);           }     }); } 

or better, use controller:

implement listeners

init: function () {     this.control({         '#fetchid': { //you can optimize componentquery             keydown: this.ontriggerkeydown,             click: this.ontriggerclick         }     });  }, 

and methods this:

ontriggerkeydown: function(trigger, e){     if (e.keycode === 32) {         this.ontriggerclick(trigger);     } }, ontriggerclick: function(trigger) {     //do thing! } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -