PDA

View Full Version : ExtJs DataProxy overrider



genTaliaru
29 Mar 2010, 1:50 AM
I tried to override Ext.DataProxy functions.

I want that in before and after every ExtJs ajax request calls the script my function.
I have coded script that looks like this

Ext.override(Ext.data.DataProxy,
{
listeners:
{
beforeload: function() {
//doo my thing here
},
load : function()
{
//doo my thing here
}
}
});


But this doesnt work, can somebody tells me how can i get it to work.

Animal
29 Mar 2010, 1:53 AM
So, not every Ajax request then, but every request made through a Proxy? Let's get this clear first.

genTaliaru
29 Mar 2010, 1:58 AM
mkay, but how can i call my fuctions in every before and after ajax request

Animal
29 Mar 2010, 2:42 AM
"Mkay" yourself.

Answer the question. There are two options, and you are not clear.

Every Ajax request.

Or every request passed through a Proxy.

When I know, then I can help.

genTaliaru
29 Mar 2010, 2:46 AM
every ajax request.

Animal
29 Mar 2010, 2:51 AM
Right.

You need to use class level observability on the Ext.data.Connection class.

http://www.extjs.com/deploy/dev/docs/?class=Ext.util.Observable&member=Observable.observeClass

genTaliaru
29 Mar 2010, 3:01 AM
thanks a lot

genTaliaru
29 Mar 2010, 4:08 AM
Ok thanks, but if want to add a functions to proxy. how do i do that?

Animal
29 Mar 2010, 4:20 AM
You mean add member functions to the class? Inject properties into its prototype.

genTaliaru
29 Mar 2010, 5:15 AM
Ok never mind, i alreay got my problem solved by using dataConnection

thanks anyway