1. #1
    Sencha User trasherdk's Avatar
    Join Date
    Dec 2008
    Location
    Thailand
    Posts
    42
    Vote Rating
    1
    trasherdk is on a distinguished road

      0  

    Question 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:
    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']
    	})
    }
    The XHR Request:
    Code:
    Parameters	application/x-www-form-urlencoded
    
    debug	0
    query	Bir
    task	get-postnr
    
    Source
    task=get-postnr&debug=0&query=Bir
    And the XHR Response: (including server sql for debug)
    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'
    }

  2. #2
    Sencha User trasherdk's Avatar
    Join Date
    Dec 2008
    Location
    Thailand
    Posts
    42
    Vote Rating
    1
    trasherdk is on a distinguished road

      0  

    Question


    Ok, one step closer. Removing the SQL part from the response
    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'
    }
    made the data appear in the ComboBox.


    Next problem. When submitting the form, with this combobox, the displayField is
    submitted, not the valueField

    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
    Here's the current version of the combobox:
    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']
    	})
    }
    Again, what am i missing?

  3. #3
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    hiddenName: 'postnr'

  4. #4
    Sencha User trasherdk's Avatar
    Join Date
    Dec 2008
    Location
    Thailand
    Posts
    42
    Vote Rating
    1
    trasherdk is on a distinguished road

      0  

    Thumbs up


    Thank you for your help. That did it.

    Now i get the valueField, and i can move on

    Code:
    data[adresse]	499/21 Kophai, Soi 9
    data[fname]	Mogens
    data[kundeid]	
    data[lname]	Melander
    data[postnr]	7190
    task	customer-save
    The working ComboBox code:
    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

  1. Populate a combo (remote store) with a default value
    By pkli in forum Ext: Discussion
    Replies: 13
    Last Post: 20 Aug 2011, 1:24 PM
  2. combobox.store.load() does not populate the combobox
    By doubleu in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 3 Jun 2010, 4:41 AM
  3. populate comboBox using remote JSON store
    By zohaib in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Nov 2009, 6:21 AM
  4. JSON store does not populate with remote data
    By Musical Shore in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 29 Oct 2009, 5:56 AM
  5. [solved] populate comboBox using remote JSON store
    By marcvs in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 14 Sep 2009, 3:59 AM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi