1. #1
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Exclamation [SOLVED] DirectStore - items not loaded

    [SOLVED] DirectStore - items not loaded


    Hi, I spent lot of hours reading tutorials and forum posts, but I still cant solve my problem...

    Code:
    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:
    Code:
    {"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.
    Last edited by vojta.jina; 21 Oct 2009 at 10:08 AM. Reason: adding solved

  2. #2
    Sencha User ThorstenSuckow's Avatar
    Join Date
    Sep 2007
    Location
    Aachen, Germany
    Posts
    597
    Vote Rating
    2
    ThorstenSuckow is on a distinguished road

      0  

    Default


    What does your

    Code:
    Ext.Geek.DirectAPI

    look like?

  3. #3
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Default


    Here is content of direct-api.js, very simple:
    Code:
    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/s...js-3.0/release

  4. #4
    Sencha User ThorstenSuckow's Avatar
    Join Date
    Sep 2007
    Location
    Aachen, Germany
    Posts
    597
    Vote Rating
    2
    ThorstenSuckow is on a distinguished road

      0  

    Default


    Try to set len to "1" - are you still working with Ext 3.0.0?

  5. #5
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Default


    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 ?

  6. #6
    Sencha User ThorstenSuckow's Avatar
    Join Date
    Sep 2007
    Location
    Aachen, Germany
    Posts
    597
    Vote Rating
    2
    ThorstenSuckow is on a distinguished road

      0  

    Default


    Sure if you have SVN access you can update your working copy to the latest HEAD revision.

  7. #7
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Default


    I have only found svn on google - as I wrote, Im using http://extjs-public.googlecode.com/s...js-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...

  8. #8
    Sencha User ThorstenSuckow's Avatar
    Join Date
    Sep 2007
    Location
    Aachen, Germany
    Posts
    597
    Vote Rating
    2
    ThorstenSuckow is on a distinguished road

      0  

    Default


    Quote Originally Posted by vojta.jina View Post
    I have only found svn on google - as I wrote, Im using http://extjs-public.googlecode.com/s...js-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.

  9. #9
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Default


    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

  10. #10
    Ext User
    Join Date
    Oct 2009
    Posts
    10
    Vote Rating
    0
    vojta.jina is on a distinguished road

      0  

    Default


    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...

Thread Participants: 1