-
25 May 2012 1:37 PM #1
Grid doesn't show data
Grid doesn't show data
Hello.
I'm evaluating Architect for possible use in a project and having trouble displaying data using a grid.
I've created a store and a model to retrieve data from a database, and it's working fine. If I go to 'Load Data' it shows the eye beside the store and shows the data inside the grid, but when previewing it in the browser, the grid is always empty.
Funny thing is, if I copy the json from the response, save it to a file and point the proxy url to this file, the data displays inside architect and in the browser too.
Please let me know what I could be missing and what code could I paste here to make things clearer.
Thanks.
-
25 May 2012 1:46 PM #2
This happens usually when you dont have autoLoad on Store set to true. But i seems like it is loading when changing the url to point to a file? Could you attach store configuration here.
Bharat Nagwani
Sencha Designer Development Team
-
25 May 2012 2:27 PM #3
Hi,
Here is the store I'm using:
If I just change 'url' to 'clients.json' (which has the same content as the response returned by the server), it works.Code:Ext.define('MyApp.store.Clients', { extend: 'Ext.data.Store', requires: [ 'MyApp.model.Client' ], constructor: function(cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ autoLoad: true, storeId: 'Clients', model: 'MyApp.model.Client', proxy: { type: 'rest', url: 'http://localhost:24738/Client', reader: { type: 'json' }, writer: { type: 'json' } } }, cfg)]); } });
Thanks.
-
25 May 2012 3:54 PM #4
What does http://localhost:24738/Client return in the browser? same response as in client.json?
Typically you have application name as part of the request so
http://localhost:24738/appname/Client.php for example. I believe your url is incorrect.Bharat Nagwani
Sencha Designer Development Team
-
26 May 2012 5:01 PM #5
No the url is fine, it's just in asp.net development server, so I don't need an app name.
As I said above, when I right click the store and choose "Load Data", it loads correctly and shows the json returned from the server. This was the response that I used to create the clients.json file.
Also, inside architect it shows the data correctly, it's just empty when I try to preview it.
-
27 May 2012 2:06 PM #6
i'm having the same problem
i'm having the same problem
i have autoload is set to true, too.
and everything seems to be linked up ok..
when i right-click the store in the project inspector, and click 'Load Data' it loads the json fine, and afterwards says 'records loaded' and i can view the response,
but for me nothing shows up in architech or when i try to preview...
in firebug console i see it load up the store file, then the model file, but not the data...
ps i'm using a tree-grid
many thanks in advance for help
-
27 May 2012 3:46 PM #7
now my problem is exactly the same
now my problem is exactly the same
i added an extra controller that simply refs the store, model and view
and now the data shows up in architect!
but not in preview....
-
27 May 2012 4:00 PM #8
ok *kinda* fixed
ok *kinda* fixed
in my new controller i added the following to two lines into the init() method, and now the data shows up
in preview....
however shouldn't this happen automagically somehow?Code:var myJsonTreeStore = Ext.getStore("MyJsonTreeStore"); myJsonTreeStore.load();
-
28 May 2012 10:35 AM #9
I've tried creating a controller to manually load the store data, but it's still not working.
The controller I used is this one:
Code:Ext.define('MyApp.controller.ClientsController', { extend: 'Ext.app.Controller', stores: [ 'Clients' ], onLaunch: function() { this.getClientsStore().load(); } });
-
28 May 2012 1:55 PM #10
Solved it.
I noticed the requests made to the server when previewing were OPTIONS, not GET, and it turned out it was because of https://developer.mozilla.org/En/HTTP_access_control as the other app was running in a different context / port.
I simply copied the ExtJs project folder into the other project and now it works perfectly.
In the end, it has nothing to do with ExtJs, but the fact that the request is a GET from inside architect and OPTIONS when executing the javascript can be confusing. Maybe it's worth an entry in your grids/store documents.


Reply With Quote