PDA

View Full Version : DirectStore with no Params bug?



Dave.Sanders
3 Aug 2009, 7:01 AM
I tripped across this today and had to set breakpoints deep in DirectProxy to believe it. I'm sorry that I don't have a ready made case to post up for comment, but here's the scenario.

Two DirectStores on the same page. One store belongs to a grid, the other to a combo. The grid store passes a parameter via the load:


myStore.load({params:{myvar:'test'}});

My combo store does NOT use any parameters - its a simple data fetch:


myOtherStore.load();

In firebug I can see both of these come back with valid data every time, the first grid will load, but the second store never loads. If I debug it, the store is never filling with data, even though data is coming back and I've triple checked my store set up with field names and root matching perfectly.

If I change the second store to add a fake param, the data loads into the second store just fine, and is available in the combo. I traced this down to DirectProxy.js and found that the callback created in createCallback is never called after the request when no params are specified, so onRead is never called, and the data is never loaded.

Can someone else confirm this? Is this expected behavior or is this a bona fide bug? Its definitely NOT what I expected to happen.

Thanks
Dave

Georgioa
3 Aug 2009, 7:35 AM
Did you tried to put paramsAsHash to false?

Dave.Sanders
3 Aug 2009, 7:48 AM
hmm, it DOES work with paramsAsHash set to false. I didn't even think of that.

This seems a little backward to me, or a bug, or at least not dev friendly. If I have no params, then paramsAsHash shouldn't matter to me. I haven't been setting paramsAsHash with my other stores because I don't need it, so it hadn't even occurred to me. Lots of hours wasted trying to figure this out. Sigh.

My suggestion: if there aren't any parameters specified on the store, then maybe default this to false, or apply whatever logic its doing to handle the callback.

Thanks Georgioa for the solution.

lxbzmy
15 Oct 2009, 11:43 PM
I traced this down to DirectProxy.js and found that the callback created in createCallback is never called after the request when no params are specified, so onRead is never called, and the data is never loaded.

I meet this problem too.finaly ,use 5 hours to location the problem in

Ext.data.DirectProxy.doRequest

directFn.apply(window, args);

args[0] is {} ,so callback not executed;


thanks this post!.:D