Results 1 to 3 of 3

Thread: ComboBox with Store and JsonReader

  1. #1

    Default ComboBox with Store and JsonReader

    Hi,

    I have some problems with reading my json generated data into a combobox.
    It doesn't show the data :-(


    My DataStore:
    Code:
        jobDataStore = new Ext.data.Store({
            id: 'jobDataStore',
            proxy: new Ext.data.HttpProxy({
                url: 'services.aspx',
                method: 'POST'
            }),
            baseParams: { task: "GETJOBS" },
            reader: new Ext.data.JsonReader({
                root: 'results',
                //totalProperty: 'total',
                id: 'No'
            }, [
                { name: 'No', type: 'string' },
                { name: 'Description', type: 'string' }
            ]),
            sortInfo: { field: 'No', direction: "ASC" }
        });
    
        jobDataStore.load();
    The column inside a editor grid:
    Code:
        ...
    
                header: 'Job No.',
                dataIndex: 'no',
                width: 150,
                editor: new Ext.form.ComboBox({
                    store: jobDataStore,
                    displayField: 'Description',
                    typeAhead: true,
                    mode: 'remote',
                    triggerAction: 'all',
                    selectOnFocus: true
                })
        ...
    I get the following json from my service:
    Code:
    { 
        results: [
                    {    
                        "No":"10023",
                        "Description":"BLABLA"
                    },
                    {
                        "No":"55405",
                        "Description":"ZOMFG"
                    }
        ] 
    }
    Can someone explain me where my mistake is?

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Posts
    29

    Default

    It looks ok. Start debugging at the beginning.

    1. In Firebug what do you get from the HTTP GET response back from the server? Are you seeing the JSON data come the server that you expect?
    2. Using console.log(), log the store load event and make sure the jobDataStore has data in it.
    3. Is it a rendering timing issue? Try calling jobDataStore.load(); from the render event of the ComboBox rather than after you create the store.
    Regards, Len

  3. #3

    Default

    Thx for your reply. I already solved it in the morning.

    There was a problem with my webservice.

    Ext rules :-)

Posting Permissions

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