How to pass custom argument via submit callback function in ExtJS
This is my callback function with custom parameter.
function successCallback(form, action, customParam){
if(customParam == '1'){
// do xxx
}
else if(customParam == '2'){
// do yyy
}
else {开发者_运维技巧
// do zzz
}
}
Do you have any idea to pass custom value via ExtJS submit configuration ?
myForm.getForm().submit({
url: 'http://mysite.com/target',
method: 'POST',
success: successCallback(9), // ??
});
Thank you.
For your case, just use this:
...
success : successCallback
...
The successCallback function will be called with all those parameters.
In future, use createDelegate for callback functions with parameters and scope.
...
success : function(){
successCallback.createDelegate(param1, param2)();
}
...
In general: http://www.terrainformatica.com/2006/08/delegates-in-javascript-now-with-parameters/
in particular:
...
success: function() { successCallback(1,2,3); } ,
...
精彩评论