javascript - Extjs confirm box callback handling -
in extjs code checking value of warning flag.
if flag set want show confirm (okcancel) box user ask user if wants proceed though there warning.
now confirm box if user clicks ok, code should proceed next command in sequence , if clicks cancel code should return.
following code:
if(warning){ ext.messagebox.show({ title: 'icon support', msg: 'are sure want proceed?', buttons: ext.messagebox.okcancel, icon: ext.messagebox.warning, fn: function(btn){ if(btn == 'ok'){ // go alert statement below. } else { return; } } ); alert('wants proceed ahead'); //if user clicks ok come here }
now problem facing when code enters if
block shows message box , alerts wants proceed ahead
.
i can stop happening putting return;
statement before alert()
.
but how go alert statement after user clicks ok button?
callbacks event driven architecture, , js interpreted language.
so best way
function somefunc(){ //some code } if(warning){ ext.messagebox.show({ title: 'icon support', msg: 'are sure want proceed?', buttons: ext.messagebox.okcancel, icon: ext.messagebox.warning, fn: function(btn){ if(btn == 'ok'){ somefunc(); } else { return; } } ); }
Comments
Post a Comment