1. #1
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,395
    Vote Rating
    23
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Exclamation Ext.data.DirectStore: root property issues

    Ext.data.DirectStore: root property issues


    Hi all,
    I'm trying to write down a simple piece of code to learn how to use a Ext.data.DirectStore, but I don't figure out what's going on.
    I explain better my problem:
    What i want to do is really simple, i want to populate a GridPanel using a directFn.
    I wrote and included in my test page a .ashx that returns me the remoting api as follow

    Code:
    Ext.app.REMOTING_API = {"type":"remoting","url":"/TestHandler.ashx","namespace":"MyApp","actions":{"Test":[{"name":"getAll","len":0}]}};
    and after that i wrote down the source code of my test page

    Code:
    var store = new Ext.data.DirectStore({
        storeId: 'fileStore',
        autoLoad: true,
        directFn: MyApp.Test.getAll,
        paramsAsHash: false,
        totalProperty: 'count',
        root: 'testData',
        fields: [
            {name:'name', type: 'string'}
        ],
        listeners: {
            dataChanged: function(store){
                Ext.Msg.alert('Store Load','The Data has been loaded!');
            }}
    });
     
    var gp = new Ext.grid.GridPanel({
        id: 'gp',
        store: store,
        renderTo: Ext.getBody(),
        height: 300,
        columns: [
            {id: 'name', header: 'Name', sortable: true, dataIndex: 'name'}
        ],
        sm: new Ext.grid.RowSelectionModel({
     
        })
    });
    });
    Now inspecting the execution with FireBug, I see the following response coming form the TestHandler.ashx

    Code:
    {"type":"rpc","tid":2,"action":"Test","method":"getAll","result":"{count:11,'testData':[{\"name\":\"kids_hug.jpg\"},{\"name\":\"kids_hug2.jpg\"},{\"name\":\"sara_pink.jpg\"},{\"name\":\"sara_pumpkin.jpg\"},{\"name\":\"sara_smile.jpg\"},{\"name\":\"up_to_something.jpg\"},{\"name\":\"zack.jpg\"},{\"name\":\"zacks_grill.jpg\"},{\"name\":\"zack_dress.jpg\"},{\"name\":\"zack_hat.jpg\"},{\"name\":\"zack_sink.jpg\"}]}","message":null}
    This is Ok beacuse it means that the DirectHandler is called correctly and i'ma ble to retrive the data I need, but the problem is that the grid doesn't populate at all.
    Note: If i change the DirectStore root property as follow

    Code:
    root: ''
    the grid will be populated with a LOT of empty records and the 'Name' column doesn't contain any value.
    Does anyone knows what i'm missing?
    I read a lot of post and everyone solved with the config

    Code:
    paramsAsHash: false
    but it doesn't seems to be my case.
    Thanks a lot!
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


  2. #2
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,395
    Vote Rating
    23
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Does Anyone has a solution for this issue?
    Any help / suggest would be appreciated.
    Thanks!
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,159
    Vote Rating
    674
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Get the latest version of the router.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,395
    Vote Rating
    23
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi Evant,
    i follow your suggest and i download the latest version of your router, you posted today at http://www.extjs.com/forum/showthread.php?t=68161, but it doesn't work too with my example, so i suppose it's a bug.
    I'm no moving forward so i'm planning to continue using my classic version of ux.FileView without integrating the new Ext.Direct development API.
    I post a screen of my "new born" ux.FileView.
    It comes with the full locale support to translate it in every language you want and fully customizable file icons using a single sprite.
    I will make a new post in the appropriate "User Extenctions" forum section when i'm done!
    If someone can help me about using Ext.Direct API i will appreciate it!
    Thanks to everybody!
    Attached Images
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


Thread Participants: 1