Results 1 to 5 of 5

Thread: Extjs 4 grid not populated

  1. #1

    Default Answered: Extjs 4 grid not populated

    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

  2. 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. #2
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    576
    Answers
    67

    Default

    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.
    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.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
    http://docs.sencha.com/ext-js/4-1/#!.../xml-grid.html

    Here is a grid that uses a restful proxy in its store.
    http://docs.sencha.com/ext-js/4-1/ex...l/restful.html

    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.

  4. #3

    Default

    Thanks for the suggestion

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


    {"receiptsRecords":[[{"amount":15000,"receiptsNo":"RC0001","noOfPcs":23,"receiptsId":1}]],"totalRecords":1}


    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

  5. #4
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    576
    Answers
    67

    Default

    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.

  6. #5

    Default

    Yes i did have too many arrays to the response
    thanks now my problem is solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •