Results 1 to 3 of 3

Thread: Creating JSON store using GET

  1. #1

    Default Creating JSON store using GET

    I have a method that returns JSON data and i want to be able to create a store based on that data returned. I have tried this version below.. but the store is still empty. I know that the JSON method returns data to the browser and is in the correct format. Any help would be great.

    Code:
    var cstore = new Ext.data.Store({
                    id: 'datestore',
                    autoLoad: true,
                    proxy: new Ext.data.HttpProxy({
                        url: '/ext/calculateownershipdata',
                        method: 'GET'
                    }),
                    reader: new Ext.data.JsonReader({
                        root: 'items',
                        totalProperty: 'totalCount',
                        fields: ['value', 'label']
                    })
                });
    JSON Data:
    Code:
    {"items":[{"value":83,"label":"Mr Jones"}]}

  2. #2

    Default

    The only thing that I am questioning is your url param. If you are certain that the url path you provided is correct, I would try adding the file extension to the end of it. I do not use HttpProxy, I use AJAX, and when I specify the URL I do not specify a file extension. Maybe because you are doing an HttpProxy you need to specify it. If you look at the examples in the documentation, they all specify a file extension. Sorry this is not a certain fix, but it may be worth a try.

    http://docs.sencha.com/extjs/3.4.0/#...data.DataProxy

  3. #3

    Default

    Thanks, all working now!

Tags for this Thread

Posting Permissions

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