Apr 08, 2016, 2:44 PM
Ext.net.DirectMethod vs Ext.net.DirectEvent vs Ext.data.Connection vs Ext.Ajax
For many years i've been using Ext.net.DirectMethod to send http requests to the application's server.
After reading the thread http://forums.ext.net/showthread.php?51091, open by @Anup, i decided it was time to have a deeper knowledge of Ext.net.DirectMethod.
I know that there are several ways to send http requests to the server, such: Ext.net.DirectMethod, Ext.net.DirectEvent, Ext.data.Connection and Ext.Ajax.
I can't remember why i decided to use Ext.net.DirectMethod and unfortunately i was not able to find any documentation directing the usage of those classes/components.
On core/direct/DirectMethod.js we have that Ext.net.DirectMethod internally uses Ext.net.DirectEvent
Source:http://docs.sencha.com/extjs/6.0/6.0...!/api/Ext.Ajax and http://docs.sencha.com/extjs/6.0/6.0....html#Ext-Ajax
It would be interesting that you provide some documentation, so we could decide the best component for each scenario.
Thanks in advance.
After reading the thread http://forums.ext.net/showthread.php?51091, open by @Anup, i decided it was time to have a deeper knowledge of Ext.net.DirectMethod.
I know that there are several ways to send http requests to the server, such: Ext.net.DirectMethod, Ext.net.DirectEvent, Ext.data.Connection and Ext.Ajax.
I can't remember why i decided to use Ext.net.DirectMethod and unfortunately i was not able to find any documentation directing the usage of those classes/components.
On core/direct/DirectMethod.js we have that Ext.net.DirectMethod internally uses Ext.net.DirectEvent
Ext.net.DirectMethod = {
request: function (name, options) {
//...
return Ext.net.DirectEvent.request(Ext.apply(options, obj));
}
};
On core/direct/DirectEvent.js we have that Ext.net.DirectEvent is acctually Ext.data.ConnectionExt.net.DirectEvent = new Ext.data.Connection();
As if that was not enough, we have Ext.Ajax, that according to sencha is:
In general, this class will be used for all Ajax requests in your application.
The main reason for creating a separate {@link Ext.data.Connection} is for a
series of requests that share common settings that are different to all other
requests in the application.
The main reason for creating a separate {@link Ext.data.Connection} is for a
series of requests that share common settings that are different to all other
requests in the application.
It would be interesting that you provide some documentation, so we could decide the best component for each scenario.
Thanks in advance.
Last edited by RaphaelSaldanha; Apr 11, 2016 at 12:08 PM.