View Full Version : Extjs 4 grid not populated

3 May 2012, 6:07 AM
I am Tryin a populate a grid with values from database
i am using extjs 4 for front end and sripes framework for backend
can anyone help me how to do this i would like to have a sample code

i tried with a lot of possibilities but i am not successful
can anyone help me with this a sample code will be useful

thank you

Tim Toady
3 May 2012, 6:50 AM
As far as the front-end is concerned, it is mostly a matter of getting your store set up correctly. Then you just want to make sure the dataIndex property in your columns matches field names in your model. The first code snippet in the store's api is a good starting point for the store.

You could send it back as json or xml depending on your store's reader (personally I prefer json). Here is a full xml grid example

Here is a grid that uses a restful proxy in its store.

Personally I don't know stripes, but I am sure there is some way to send back data as json or xml. If you don't have a root defined you basically send back a json array filled with objects with each property of the model defined in them. If you do have a root, you will do the same thing except that array will be in an object with your rootname as the the property it is under.

The store example listed first shows what json should look like for nested objects so it doesn't match exactly the model in the snippet, but gives the general idea. Also, pull out firebug and look at the data coming back in the restful example if you still don't get it.

3 May 2012, 7:38 AM
Thanks for the suggestion

now i am getting the response as same as that of the example like


but still i am unable to load the data in the grid
my model class and the field name of the store are the same

Tim Toady
3 May 2012, 7:46 AM
your receiptsRecords property has one too many arrays. Also, you shouldn't need a total property unless you are paging. If that still doesn't work, please share some code so I can see if there are any issues.

3 May 2012, 8:23 AM
Yes i did have too many arrays to the response
thanks now my problem is solved