views:

865

answers:

2

Here is my Extjs onReady function

var store = new Ext.data.Store({
                                  proxy: new Ext.data.HttpProxy({
                                  url: '/loginjson.json'
                                  }),

                                  reader: new Ext.data.JsonReader(
                                  {root: 'row', fields:['dblist']}
                                    )
                    });
            store.load();

and here I'm using it in my FormPanel like

renderTo: document.getElementById("loginform"),
                                    title: "Login Form",
                                    items: [{
                                        xtype: 'combo',
                                        fieldLabel: 'genre',
                                        name: 'genre',
                                        store: store,
                                        autoLoad: true,
                                        displayField: 'dblist',
                                    }

and JSON URL of django returns like this

http://localhost:8000/loginjson.json

{"row": [{"dblist": "datalist"}]}

but my combobox is not filled I'm missing somewhere on extJS but couldn't found.

A: 

I think the fields property of your JSON reader is not configured correctly. Try this:

reader: new Ext.data.JsonReader({
            root: 'row'
        ,   fields:[{name: "dblist"}]
        })
Roland Bouman
Plain string names are acceptable in a reader's fields array. They default to type 'auto'.
owlness
Thanks owlness!
Roland Bouman
+3  A: 

If you are expecting the ComboBox to behave more like an HTML select field then add to your ComboBox config the property:

triggerAction: 'all'

This will ensure that all items in the store will be displayed when the field's trigger button is clicked.

The ComboBox config will also be needing a valueField property:

valueField: 'dblist'

Also, explicitly calling the store's load method is not necessary. The ComboBox will handle that for you at the appropriate time.

owlness
@owlness thanks on the first attempt it worked, can you suggest me any pdf or online portal, that can help me to sort out such problems. as I'm dummy for extjs right now.
Tumbleweed
The best resource on ExtJS is the ExtJS site (http://www.extjs.com/). Between the API documentation, forums, examples, and wiki ("Learning Center") there is plenty of knowledge to be obtained.
owlness