Ext. ajax. this parameter is not synchronized in the request parameter. However, many requests need to be synchronized to provide data in componnet without the add method. For example, the dynamic check option in checkboxgroup should be modified. ajax. the real Request Method Ext. lib. ajax. request
The code is from the ext official forum:
Ext. Lib. Ajax. Request = function (method, Uri, CB, Data, options ){
If (options ){
VaR HS = options. headers;
If (HS ){
For (VAR h in HS ){
If (HS. hasownproperty (H )){
This. initheader (H, HS [H], false );
}
}
}
If (options. xmldata ){
If (! HS |! HS ['content-type']) {
This. initheader ('content-type', 'text/xml', false );
}
Method = (method? Method: (options. method? Options. Method: 'post '));
Data = options. xmldata;
} Else if (options. jsondata ){
If (! HS |! HS ['content-type']) {
This. initheader ('content-type', 'application/json', false );
}
Method = (method? Method: (options. method? Options. Method: 'post '));
Data = typeof options. jsondata = 'object '? Ext. encode (options. jsondata): Options. jsondata;
}
}
Return this ["sync" in options? "Syncrequest": "asyncrequest"] (method, Uri, CB, data); // specifies the method to call. If sync is passed, syncrequest is called, otherwise, the original method asyncrequest} is called };
The syncrequest method is as follows:
Ext. Lib. Ajax. syncrequest = function (method, Uri, callback, postdata)
{
VaR o = This. getconnectionobject ();
If (! O ){
Return NULL;
}
Else {
O. Conn. Open (method, Uri, false );
If (this. usedefaultxhrheader ){
If (! This. defaultheaders ['x-requested-with']) {
This. initheader ('x-requested-with', this. defaultxhrheader, true );
}
}
If (postdata & this. usedefaultheader &&(! This. hasheaders |! This. headers ['content-type']) {
This. initheader ('content-type', this. defaultpostheader );
}
If (this. hasdefaultheaders | this. hasheaders ){
This. setheader (O );
}
O. Conn. Send (postdata | null );
This. handletransactionresponse (O, callback );
Return O;
}
};
Call:
Ext. Ajax. Request ({
URL :'',
Scope: This,
Sync: True,
Success: function (){}
});