PDA

View Full Version : [SOLVED] DirectStore - items not loaded



vojta.jina
17 Oct 2009, 12:24 PM
Hi, I spent lot of hours reading tutorials and forum posts, but I still cant solve my problem...



Ext.onReady(function() {
Ext.Direct.addProvider(Ext.Geek.DirectAPI);

var store = new Ext.data.DirectStore(
{
directFn: Stereotype.get,
fields: [
'id', 'aa', 'bb'
],
root: 'result.rows',
idProperty: 'id',
totalProperty: 'total',
paramsAsHash: false
});

store.load({callback: function(){alert('sss');}});
Ext.testingStore = store;
Direct call Stereotype.get returns this json:

{"result":{"rows":[{"id":1,"aa":"aaa","bb":"bbb"},{"id":2,"aa":"xxx","bb":"zzz"}],"total":2,"success":true,"status":true},"type":"rpc","tid":2,"action":"Stereotype","method":"get"}
After execution, I can see the request in the firebug, it looks right...
But when I use this store for grid, grid is empty...
The alert in callback is also not executed.
When I try >> console.log(Ext.testingStore.data.items); its empty !!!
Maybe Im missing something... But I cant find it out...
Thanks a lot for advice..
V.

ThorstenSuckow
18 Oct 2009, 5:12 AM
What does your


Ext.Geek.DirectAPI


look like?

vojta.jina
18 Oct 2009, 9:02 AM
Here is content of direct-api.js, very simple:


Ext.Geek.DirectAPI = {
"url":"\/admin.php\/direct",
"type":"remoting",
"actions": {
"Stereotype": [{"name": "get", "len": 0}]
}
};


Im using Ext 3.0 from svn: http://extjs-public.googlecode.com/svn/tags/extjs-3.0/release

ThorstenSuckow
18 Oct 2009, 9:07 AM
Try to set len to "1" - are you still working with Ext 3.0.0?

vojta.jina
18 Oct 2009, 10:23 AM
I know about some problem with len:0 (Im using Ext 3.0.0), but when I set len to 1, nothing happens... Still the same...
But also no errors...

Btw, is possible to get 3.0.1 using svn ?

ThorstenSuckow
18 Oct 2009, 10:27 AM
Sure if you have SVN access you can update your working copy to the latest HEAD revision.

vojta.jina
18 Oct 2009, 10:57 AM
I have only found svn on google - as I wrote, Im using http://extjs-public.googlecode.com/svn/tags/extjs-3.0/release.
There is no 3.0.1 version. I cant download 3.0.1 patch from the web, Im not registered user (Im just testing ExtJS, so I dont have the commercial version)

But this problem with DirectStore makes me crazy. No errors, no warnings, but items[] is empty... Nothing loaded...

ThorstenSuckow
18 Oct 2009, 11:02 AM
I have only found svn on google - as I wrote, Im using http://extjs-public.googlecode.com/svn/tags/extjs-3.0/release.
There is no 3.0.1 version. I cant download 3.0.1 patch from the web, Im not registered user (Im just testing ExtJS, so I dont have the commercial version)

But this problem with DirectStore makes me crazy. No errors, no warnings, but items[] is empty... Nothing loaded...

Hm, AFAICS Ext.Direct won't be stable until 3.1 - so it should be worth the wait. Revert to HttpProxy and update later on, this is my best advise for now, as there are even a few shortcomings in 3.0.3.

vojta.jina
18 Oct 2009, 11:10 AM
Hmm, but I downloaded pmea (http://www.jbruni.com.br/pmea/), its not finished app, but it works and its also using DirectStore... On my local, it works with the same ext library (3.0.0), as the code above (my problem code) uses...

I want to use Direct, is pretty nice, I hope I did some mistake, but I cant find it :-D

vojta.jina
21 Oct 2009, 10:06 AM
Solved ! The problem was in bad $len parameter in Direct API !
I had len: 1 and len: 0 tested, but DirectStore add 2 params: sort, dir (when remote sorting is true).

Is there any possibility how to debug these things ? Its very difficult to find out bugs like that... No error in Firebug. Im using ext-debug, but it says nothing...