View Full Version : close after submit event

19 Jan 2014, 7:41 PM
Hey guys, I am learning extjs and i am having a simple issue which no matter where i look for the answer i can not find it.
So the issue is i want to submit when button clicked and then close but it fires the close before the submit and i get store data undefined.
Any help is appreciated.

if [email protected]
text: 'Save & Close'
scope : me
#hidden : #me.readOnly
name: "saveRequestButton"
type: submit
me.close() <-will close but will fire before submit event i need it to submit and then close.


Gary Schlosberg
19 Jan 2014, 8:41 PM
Does it work if you use the handler as in the example on this page?

You could close the page if successful, return a message if not.

19 Jan 2014, 9:24 PM
saveButtonandClose= { text: 'Save & Close'
scope : me
name: "saveRequestButton"
form = this.up('form').getForm()
if form.isValid
success:()-> me.close()
does this look correct to you because i tried this and it is still not closing the window should i try ext.getcmp("someID').close() ???

i actually tried this checked the stack and Uncaught TypeError: Cannot call method 'getForm' of undefined

the funny thing is it is submitting just not god-damn closing.This is driving me up the wall lol

20 Jan 2014, 12:36 AM
Hello billhamawi,
I guess you went wrong with the scopes. 'this' in your handler might not be the button component unless you define it in the argument as some variable. Say

handler : function(btn){
btn-- > is your button component
this--> is you class/parent scope