1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    work2gs is on a distinguished road

      0  

    Default json format for rootProperty

    json format for rootProperty


    Hi
    my json url
    http://www.yelotag.com/light/BizRef-Web-DomainService1.svc/JSON/GetAllUsers

    return this data:

    {"GetAllUsersResult":{"TotalCount":3,"RootResults":[{"Id":1,"name":"fred "},{"Id":2,"name":"toto "},{"Id":3,"name":"titi "}]}}

    what is the value for rootProperty of the tree store,
    I try several way without success
    'GetAllUsersResult.TotalCount.RootResults'
    'GetAllUsersResult.RootResults'
    ...

    I obtain this error in google chrome debug
    Uncaught SyntaxError: Unexpected token :

    Could you help, I am stuck since 2 days...
    Thanks
    Fred
    {
    xtype: 'nestedlist',
    title: 'Blog',
    iconCls: 'star',
    cls: 'blog',
    displayField: 'name',


    store: {
    type: 'tree',


    fields: ['Id','name'],


    proxy: {
    type: 'jsonp',
    url: 'http://www.yelotag.com/light/BizRef-Web-DomainService1.svc/JSON/GetAllUsers',
    reader: {
    type: 'json',
    rootProperty: 'GetAllUsersResult.TotalCount.RootResults'
    }
    }
    },
    }

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Worked for me but with ajax proxy:

    Code:
    Ext.define('MyApp.store.MyJsonPStore', {
        extend: 'Ext.data.Store',
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                storeId: 'MyJsonPStore',
                proxy: {
                    type: 'ajax',
                    url: 'http://www.yelotag.com/light/BizRef-Web-DomainService1.svc/JSON/GetAllUsers',
                    reader: {
                        type: 'json',
                        idProperty: 'Id',
                        root: 'GetAllUsersResult.RootResults'
                    }
                },
                fields: [
                    {
                        name: 'Id'
                    },
                    {
                        name: 'name'
                    }
                ]
            }, cfg)]);
        }
    });
    x1.png
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    work2gs is on a distinguished road

      0  

    Default


    Hi
    Thanks a lot...
    I didn't obtain this error.
    Now I have this new error when I am running in chrome this url
    http://127.0.0.1:8080/GS01/

    Any idea ?
    Thanks
    Fred


    [COLOR=red !important]http://www.yelotag.com/light/BizRef-...art=0&limit=25Failed to load resource: the server responded with a status of 405 (Method Not Allowed)[/COLOR]
    [COLOR=red !important]XMLHttpRequest cannot load http://www.yelotag.com/light/BizRef-...art=0&limit=25. Origin http://127.0.0.1:8080 is not allowed by Access-Control-Allow-Origin.[/COLOR]

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,240
    Vote Rating
    121
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Looks like you are trying to pass parameters and the server-side is rejecting that for the particular HTTP method.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2