1. #1
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19
    Vote Rating
    2
    HansGroeneveld is on a distinguished road

      0  

    Default No data in Json store in deploy mode

    No data in Json store in deploy mode


    I create my first simple app that gets information from ower SQL Anywhere database by a webservices in Json format. When I click Load Data in the develop environment I can see the data. But when I do Preview there is no data loaded.
    I think the problem is that the SQL Anywhere Webservices generate Json without a root property see below, therefor I can not set a rootProperty in Secnha. I think that Sencha did not know what to do?
    Is that right or should this not be a problem and have I to look somewhere else?
    Tia
    Hans

    [ { "klant": 2, "ordernr": 1, "aantal": 264.00, "waarde": 234.96000 }, { "klant": 3, "ordernr": 2, "aantal": 264.00, "waarde": 120.24000 }
    ]

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    206
    Vote Rating
    8
    allisterf is on a distinguished road

      0  

    Default


    Do you have autoload set on the store config?

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19
    Vote Rating
    2
    HansGroeneveld is on a distinguished road

      0  

    Default


    Yes I have set autoload.

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19
    Vote Rating
    2
    HansGroeneveld is on a distinguished road

      0  

    Default


    About my post, it did not work in the development environment neither.
    (I tried first with a XML proxy that works fine in de development environment but not in the browser, but I saw several posts about different domains and therefor changed my proxy to JsonP).

    Below my code:

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    
    Ext.application({
        models: [
            'MyModel'
        ],
        stores: [
            'MyStore'
        ],
        views: [
            'MyTabPanel'
        ],
        name: 'MyApp',
    
        launch: function() {
    
            Ext.create('MyApp.view.MyTabPanel', {fullscreen: true});
        }
    
    });
    
    Ext.define('MyApp.store.MyStore', {
        extend: 'Ext.data.Store',
        requires: [
            'MyApp.model.MyModel'
        ],
    
        config: {
            autoLoad: true,
            model: 'MyApp.model.MyModel',
            storeId: 'MyStore'
        }
    });
    
    Ext.define('MyApp.model.MyModel', {
        extend: 'Ext.data.Model',
        config: {
            fields: [
                {
                    name: 'waarde',
                    type: 'float'
                },
                {
                    name: 'aantal',
                    type: 'float'
                },
                {
                    name: 'ordernr',
                    type: 'int'
                },
                {
                    name: 'klant',
                    type: 'int'
                }
            ],
            proxy: {
                type: 'jsonp',
                url: 'http://tspalm:8082/sa12/get_ordervalue',
                reader: {
                    type: 'json'
                }
            }
        }
    });
    Error in the Designer:
    Unable to load data using the supplied configuration.
    Open in Browser: http://tspalm:8082/sa12/get_ordervalue

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    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


    And if you click on the link it shows... does it open in the browser?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19
    Vote Rating
    2
    HansGroeneveld is on a distinguished road

      0  

    Default


    It does open in the browser. When I look in Chrome with developer mode I can see the data is retrieved also.

    I found the following below, it seems that a empty rootProperty is for clearing a store..?
    But how to deal with Json without a root?


    http://docs.sencha.com/touch/2-0/source/Reader.html#Ext-data-reader-Reader-cfg-rootProperty


    * @cfg {String} rootProperty
    * The name of the property which contains the Array of row objects. For JSON reader it's dot-separated list
    * of property names. For XML reader it's a CSS selector. For array reader it's not applicable.
    *
    * By default the natural root of the data will be used. The root Json array, the root XML element, or the array.
    *
    * The data packet value for this property should be an empty array to clear the data or show no data.
    */
    rootProperty: '',

  7. #7
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19
    Vote Rating
    2
    HansGroeneveld is on a distinguished road

      0  

    Default


    You may close this thread.
    The problem is int JsonP, at the server side.

  8. #8
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,413
    Vote Rating
    129
    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


    Thanks for the update.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2

Tags for this Thread