Answer the question
In order to leave comments, you need to log in
Function substitution in Ext.JS?
There were problems when replacing some functions in the new Ext.JS.
The challenge is to add response text handling to DirectEvent. Processing happens with callback.
With various crutch methods, I almost solved the problem, but now a problem has arisen. When sending text for decryption, I need to stop further execution of the success function. And it's just not there!
Here is part of the code:
Ext.net.DirectEvent = new Ext.data.Connection({
//...всякие параметры...
listeners : {
beforerequest : {
fn : function (conn, options) {
//...кроме всего прочего, здесь объявляются локальные функции и переменные
options.success = function (response, options) {
var o = options;
removeMask(o);
//...
var parsedResponse = o.scope.parseResponse(response, options);
//вот здесь надо оборвать, если parsedResponse пустой.
//...
}
},
//...
});
Ext.net.DirectEvent.addListener('beforerequest',function(req,o) {
debugger;
eval('o.success = '+o.success.toString().split('var parsedResponse = o.scope.parseResponse(response, options);').join('var parsedResponse = o.scope.parseResponse(response, options); if (!parsedReaponse) return;debugger;'));
return true;
});
removeMask
declared in the local context of the original beforerequest listener. success
with a zero answer parseResponse
. success
, there is a break on the next line with an error (cannot read property of undefined), but I want it to be normal and without errors. throw
doesn't fit either.
Answer the question
In order to leave comments, you need to log in
and why "return false" is not suitable?
according to the sources, it should abort the execution of the request
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question