View Full Version : value field display instead of the display field name in combo box

3 Jan 2011, 4:54 AM
my problem is when loading a form with combobox in edit mode the valuefield is displayed instead of the displayfield

my store

var departmentStore = new Ext.data.JsonStore({
url: 'view/department.php',
root: 'rows',
idProperty: 'dept_idno',
totalProperty: 'results',
fields: ['dept_idno', 'dept_type'],
remoteSort: true

my form

var empRecordForm = new Ext.form.FormPanel({
id: 'employeerecord-edit'
,baseCls: 'x-plain'
,labelWidth: 130 // label settings here cascade unless overridden
,defaultType: 'textfield'
,labelAlign: 'top'
,bodyStyle:'padding:5px 5px 0'
,items: [{ xtype: 'combo'
,fieldLabel: 'Department'
,name: 'departmentname'
,id: 'departmentID'
,triggerAction: 'all'
,typeAhead: true
,emptyText: "Please select Department."
,blankText:"This field is required!"
,store: departmentStore
,displayField: 'dept_type'
,valueField: 'dept_idno'
,hiddenName: 'hn_department'

my response


dept_idno = 1 and the dept_type = Supervisor

how can i make the department combo box display the value "Supervisor"

thanks in advance

3 Jan 2011, 5:38 AM
I guess you need to send next response

{'success': true, 'rows':{'dept_idno':1,'dept_type': 'Supervisor'}}

3 Jan 2011, 9:42 AM
i tried it but it doesnt work.. its still displaying the department id no

3 Jan 2011, 12:28 PM
got it work..

just need to load the departmentStore first...

my bad..

thanks for the help :D