-
9 May 2011 9:44 PM #1
Combobox - Populate from remote store
Combobox - Populate from remote store
I'm currently struggling with a ComboBox on a form, and it seems that
i'm missing something. Date is loaded from database to a JsonStore.
All looks OK, bu nothing show up in the ComboBox.
What am i missing?
The ComboBox:
The XHR Request:Code:{ id:'customer-pnr' ,fieldLabel: 'Postnummer' ,name: 'postnr' ,xtype: 'combo' ,typeAhead: true ,minChars: 3 ,loadingText: 'Loading...' ,triggerAction: 'all' ,lazyRender: true ,mode: 'remote' ,allowBlank: false ,valueField: 'postnr' ,displayField: 'bynavn' ,store: new Ext.data.JsonStore({ autoDestroy: true ,url: '/mossin/php/customerform.php' ,baseParams: { task: 'get-postnr' ,debug: 0 } ,root: 'rows' ,totalProperty: 'results' ,fields: ['postnr', 'bynavn'] }) }
And the XHR Response: (including server sql for debug)Code:Parameters application/x-www-form-urlencoded debug 0 query Bir task get-postnr Source task=get-postnr&debug=0&query=Bir
Code:{ success: true, results: 1, rows: [{ "postnr":"3460", "bynavn":"Birker\u00f8d" }], sql:'select postnr, bynavn from postnumre where postnr like 'Bir%' or bynavn like 'Bir%' order by bynavn' }
-
10 May 2011 12:16 AM #2
Ok, one step closer. Removing the SQL part from the response
made the data appear in the ComboBox.Code:{ success: true, results: 1, rows: [{ "postnr":"3460", "bynavn":"Birker\u00f8d" }], sql:'select postnr, bynavn from postnumre where postnr like 'Bir%' or bynavn like 'Bir%' order by bynavn' }

Next problem. When submitting the form, with this combobox, the displayField is
submitted, not the valueField
Here's the current version of the combobox:Code:Parameters application/x-www-form-urlencoded data[adresse] 499/21 Kophai, Soi 9 data[fname] Mogens data[kundeid] data[lname] Melander data[postnr] Billum task customer-save Source task=customer-save&data%5Bkundeid%5D=&data%5Bfname%5D=Mogens&data%5Blname%5D=Melander&data%5Badresse%5D=499%2F21%20Kophai%2C%20Soi%209&data%5Bpostnr%5D=Billum
Again, what am i missing?Code:{ id:'customer-pnr' ,fieldLabel:'Postnummer' ,name:'data[postnr]' ,xtype:'combo' ,typeAhead: true ,minChars: 3 ,emptyText:'Select a City...' ,loadingText: 'Loading...' ,triggerAction: 'all' ,lazyRender: true ,mode: 'remote' ,allowBlank: false ,valueField: 'postnr' ,displayField: 'bynavn' ,store: new Ext.data.JsonStore({ autoDestroy: true ,autoLoad: false ,url: '/mossin/php/customerform.php' ,baseParams: { task: 'get-postnr' ,debug: 0 } ,root: 'rows' ,totalProperty: 'results' ,id: 'postnr ,idProperty: 'postnr' ,fields: ['bynavn'] }) }
-
10 May 2011 4:02 AM #3
-
10 May 2011 8:32 PM #4
Thank you for your help. That did it.
Now i get the valueField, and i can move on
The working ComboBox code:Code:data[adresse] 499/21 Kophai, Soi 9 data[fname] Mogens data[kundeid] data[lname] Melander data[postnr] 7190 task customer-save
Code:{ id: 'customer-pnr' ,fieldLabel: 'Postnummer' // ,name: 'data[postnr]' ,hiddenName: 'data[postnr]' ,xtype: 'combo' ,typeAhead: true ,minChars: 3 ,emptyText: 'Select a City...' ,loadingText: 'Loading...' ,triggerAction: 'all' ,lazyRender: true ,mode: 'remote' ,allowBlank: false ,valueField: 'postnr' ,displayField: 'bynavn' ,store: new Ext.data.JsonStore({ autoDestroy: true ,autoLoad: false ,url: '/mossin/php/customerform.php' ,baseParams: { task: 'get-postnr' ,debug: 0 } ,root: 'rows' ,totalProperty: 'results' ,id: 'postnr' ,idProperty: 'postnr' ,fields: ['postnr','bynavn'] }) }
Similar Threads
-
Populate a combo (remote store) with a default value
By pkli in forum Ext: DiscussionReplies: 13Last Post: 20 Aug 2011, 1:24 PM -
combobox.store.load() does not populate the combobox
By doubleu in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 3 Jun 2010, 4:41 AM -
populate comboBox using remote JSON store
By zohaib in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 26 Nov 2009, 6:21 AM -
JSON store does not populate with remote data
By Musical Shore in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 29 Oct 2009, 5:56 AM -
[solved] populate comboBox using remote JSON store
By marcvs in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 14 Sep 2009, 3:59 AM


Reply With Quote