PDA

View Full Version : Using ExtJs 4 with ASP.Net



dhiraj17
21 Mar 2012, 9:39 PM
I am using Extjs 4.0 with ASP.Net to display the data in a extjs grid. I am calling a web service to fetch the data from the database and returns the data in JSON format. I saw the debugger in developer tools and the methods returns the data in data format. But the data is not displayed in the grid. The same example works with Extjs 3 properly. There is no error as well being shown in the error console while running the example with extjs 4. I need the solution to this as early as possible.

mitchellsimoens
22 Mar 2012, 6:51 AM
What does your store and model look like and a sample response?

dhiraj17
25 Mar 2012, 10:55 PM
Hey thanks for the reply. I got my code working. :)

webfriend13
26 Mar 2012, 1:03 AM
What was the problem ?

dhiraj17
26 Mar 2012, 4:49 AM
In ExtJS 3 my store was(which did not work in ExtJs 4):

var store = new Ext.data.JsonStore({
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: 'myurl',
headers: {
'Content-type': 'application/json'
}
}),
root: 'd', // Root Json element, always 'd'
id: 'Id', // Identifier column, ExtJS needs it to recognize rows
fields: ['Id', 'FirstName', 'LastName', 'BirthDate'] // Simple definition of columns
});

For ExtJs 4 I changed it to:

Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'myurl',
headers: {
'Content-Type': 'application/json'
},
reader: {
type: 'json',
root: 'd',
successProperty: 'success'
}
}
});


Bt still I can't figure out what was the problem with the above code that i used in ExtJs 3. I think that should have work too in ExtJs 4.