View Full Version : Consuming a JsonStore

18 Mar 2011, 7:10 AM
I'm trying to consuming a JsonStore from a WebService.

var myStore = new Ext.data.JsonStore({
// Load data at once
autoLoad: true,
// Override default http proxy settings
proxy: new Ext.data.HttpProxy({
// Call web service method using GET syntax
url: 'Test.asmx/HelloWorld',
// Ask for Json response
headers: { 'Content-type': 'application/json' }
// Root variable
root: 'd',
// Record identifier
id: '__type',
// Fields declaration
fields: ['__type', 'firstName', 'lastName']

With Fiddler I check what i get from the web service:

{"d":{"__type":"TestUser","firstName":"Lennie","lastName":"De Villiers"}}

But when I check myStore afterwards it is empty. I dont get any errors or anything. I have struggled with this for hours and hours.


18 Mar 2011, 1:10 PM
Not sure what you mean by "consuming a JSONStore"?

Do you want to access the data once it is returned?

if so do this

scope: this,
callback: function(records, operation, success){
var mydata = records;//breakpoint here to see your data

Is this your returned JSON?

{"d":{"__type":"TestUser","firstName":"Lennie","lastName":"De Villiers"}}