View Full Version : render store data from a file...help meee

19 Apr 2012, 7:44 AM
Hello everybody...
I've so far been able to get static data for my store using 'data'

how do I get the data for the store from a file on the server that my project is located on...?
where do I place the data file?

I've tried having a combo box such as:

"id": "ExtBox1-ext-gen46585",
"type": "combobox",
"reference": {
"name": "items",
"type": "array"
"codeClass": null,
"userConfig": {
"id": "d_alertsNum",
"itemId": "d_alertsNum",
"style": "margin-right:10px;\n",
"width": 191,
"name": "'results'",
"fieldLabel": "Alert Trends Results",
"labelAlign": "right",
"labelSeparator": " ",
"labelWidth": 130,
"allowBlank": false,
"editable": false,
"displayField": "results",
"forceSelection": true,
"queryMode": "local",
"store": "d_alertsNumStore",
"valueField": "results",
"designer|userClassName": "MyComboBox"

and a store attached as:

Ext.define('MyApp.store.d_alertsNumStore', {
extend: 'Ext.data.Store',

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
autoLoad: true,
storeId: 'd_alertsNumStore',
clearOnPageLoad: false,
proxy: {
type: 'ajax',
url: 'results.json', //or any other file...suggestions???
reader: {
type: 'array'
fields: [
name: 'results',
type: 'int'
}, cfg)]);

the things I really can't figure are:
1. the exact settings that I need to have in order for the store to retrieve its data from a server file
2. where I need to place the file...
3. is the server file supposed to return a json object or just contain it

Thank you all :-)

19 Apr 2012, 8:07 AM
Basically you would have the server return the JSON.
Same premise using the static JSON. The return just needs to be the same.

url: 'mylist.php',

ex: mylist.php (simplified)

<? php
echo ''; // json string goes here

What is your backend for your server? PHP, or?


22 Apr 2012, 1:17 AM
It's actually Python that returns a JSON object

is there a specific folder in which I should store my files at Scott?
or can I specify an absolute path before the filename?

and thanks for your help( again :-) )

22 Apr 2012, 1:19 AM
Do I also need to change the query mode to 'remote' ?
are all of my settings ok for that form?


22 Apr 2012, 8:08 AM
ok I got it...but...why does it return the whole string of the file(its source-code) instead of running the file as it'd happen when using get\post....

how can I run the file and have the response.responseText field hold the output of the python file?