-
14 Jun 2012 10:30 PM #1
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 }
]
-
15 Jun 2012 4:32 AM #2
Do you have autoload set on the store config?
-
15 Jun 2012 4:48 AM #3
-
15 Jun 2012 4:58 AM #4
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:
Error in the Designer: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' } } } });
Unable to load data using the supplied configuration.
Open in Browser: http://tspalm:8082/sa12/get_ordervalue
-
15 Jun 2012 8:59 AM #5
And if you click on the link it shows... does it open in the browser?
Aaron Conran
@aconran
Sencha Architect Development Team
-
17 Jun 2012 10:26 PM #6
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: '',
-
18 Jun 2012 7:06 AM #7
You may close this thread.
The problem is int JsonP, at the server side.
-
18 Jun 2012 9:43 AM #8
Thanks for the update.
Aaron Conran
@aconran
Sencha Architect Development Team


Reply With Quote