PDA

View Full Version : [OPEN] [CLOSED][3.0.0] HttpProxy.load() deprecated or removed?



extjs@peacetech.com
10 Jul 2009, 1:23 PM
Documentation states it is depricated but from what I can see it is completely removed breaking 2.x compatibility. Is it intentional?

I am using SVN as of today.

thank you,
alex

tryanDLS
10 Jul 2009, 1:45 PM
Something odd there. It's marked deprecated, but the function is set to null in dataProxy. Moving to bugs.

extjs@peacetech.com
10 Jul 2009, 1:59 PM
also, please check if load calls callbacks properly. I set load to HttpProxy to delegate to doRequest and callback receives onu record block parameter but options and sucess flag are undefined

mjlecomte
10 Jul 2009, 2:18 PM
That code is intentional. Would you please post your test case to help clarify what you perceive to be the issue?

As the docs say, the load method is deprecated, the preferred method for custom proxies to implement is doRequest(). I'd have to guess that you're calling Http::load() directly for some reason, a test case would be helpful. Typically the requests should be directed to the request() method.

extjs@peacetech.com
10 Jul 2009, 4:13 PM
Hello MJ,

I do use proxies directly good deal to fetch structured data (i.e. arrays) and in 2.x it was load method (I do not recall request() being in 2.x) Now all my code is broken with 3.0 because load() is not deprecated but actually is removed (set to null)

just to fix it I did


if (Ext.data.HttpProxy.prototype.doRequest) {
Ext.data.HttpProxy.prototype.load = function( params, reader, callback, scope, arg ) {
this.doRequest('read', null, params, reader, callback, scope, arg);
};
}


and it worked except for callback being called with options and success fields undefined

I am not sure how 3.0 could be backward compatible with 2.x without this load method. I suspect many people use proxy directly.

Please let me know what sample code would be helpful. I am just talkin basic proxy.load() calls

aconran
11 Jul 2009, 5:54 AM
Were you using the proxy outside of the constructs of the Store?

If not, why not just call Store's load method and allow it to work with the internals itself. I think this is probably a pretty rare case, but it would be helpful if others are having the same problem to speak up.

extjs@peacetech.com
11 Jul 2009, 9:19 AM
Hi Aaron,

I use proxies when I need to fetch some data but do not need it in a store (say some packets of data to add to a store on some user triggered event ...) or need to transform data some before handing it off to GUI

It is particulary useful when I want to make data access capable of either same domain or cross domain data access depending on some service service deployed separate or with application

I could of course create and use a store every time I need to fetch some data but why extra overhead?

JP_ExtJS
13 Jul 2009, 11:41 AM
"We removed a method from a publicly usable class and we wrongly documented it as deprecated. We are very busy people and believe this is perfectly reasonable. We might change our mind but not unless the whole community "speaks up" ".

mjlecomte
13 Jul 2009, 1:07 PM
"We removed a method from a publicly usable class and we wrongly documented it as deprecated. We are very busy people and believe this is perfectly reasonable. We might change our mind but not unless the whole community "speaks up" ".

Maybe I misunderstand, if there's a constructive comment to be made, would you care to clarify what your statement is?

tryanDLS
14 Jul 2009, 7:01 AM
He's trying to say that
1) load is marked deprecated, not unsupported - but that's not in fact the case b/c the load=null in the code.
2) Replies to this thread have questioned the usage of load, not the fact this is an undocumented breaking change, or removing it was an error and load should be re-instated into the code base.

hendricd
14 Jul 2009, 9:23 AM
Well, regardless of the debate, that change breaks:

ux.PagingMemoryProxy
ux.BufferedPagingMemoryProxy (I've already revised for 3.0)

and I would imagine some past flavors of the ScriptTagProxy need scrutiny as well. :-?

aconran
14 Jul 2009, 9:30 AM
Doug -

It's actually done this way to support those Proxies. We have tested many legacy proxies which implement load and they work fine. Please test these legacy proxies and let us know if you run into any problems.

hendricd
14 Jul 2009, 9:38 AM
Doug -

It's actually done this way to support those Proxies. We have tested many legacy proxies which implement load and they work fine. Please test these legacy proxies and let us know if you run into any problems.

I've already taken care of mine, but I did have to implement the doRequest method, as the former load method never got called by the store.

No Prob, tho man. ;)

mribbons
8 Aug 2009, 12:48 AM
Hi,
I have my own request class which uses Ext.data.HttpProxy in a non Store context.

Below is a simple example. Can someone suggest how I might change this code to make it compatible with the 3.x platform?



Ext.onReady(function() {

var btnDoRequest = new Ext.Button({
text: 'Do Request',
handler: btnDoRequest_Click
});

var form = new Ext.form.FormPanel({
baseCls: 'x-plain',
layout:'absolute',
url:'save-form.php',
defaultType: 'textfield',

items: [{
x:0,
y: 0,
xtype: 'textarea',
id: 'txtSomeStuff',
name: 'msg',
anchor: '100% 100%' // anchor width and height
}]
});

var window = new Ext.Window({
title: 'Ext.data.HttpProxy Test',
width: 500,
height:300,
minWidth: 300,
minHeight: 200,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
items: form,
buttonAlign:'center',

buttons: [
btnDoRequest
]
});

window.show();

});

var rspResponse;

function btnDoRequest_Click()
{

var conn = new Ext.data.Connection({
url: "" + window.location
});

var xml = new Ext.data.HttpProxy(conn);

xml.on('loadexception', XmlExceptionCallback);

xml.load(
null,
{ read: function(response) { rspResponse = response } },
InnerCallback
);
}

function XmlExceptionCallback(e)
{
alert("XmlException: " + e);
}

function InnerCallback()
{
var txt = Ext.getCmp('txtSomeStuff');
txt.setValue(rspResponse.responseText);
}


Cheers.

Animal
8 Aug 2009, 1:01 AM
Why would you use a Proxy without a Store? Makes no sense at all.

You'd just use Ext.Ajax

mribbons
8 Aug 2009, 1:07 AM
Because I thought that's how it was done?

The docs for Ext.Ajax look good, thanks.