View Full Version : Ext3->Ext4 problem with Ext.form.field.ComboBox and value/hiddenValue

11 Feb 2012, 6:53 AM
Dear sir

my problem is to handle an Ext.form.field.ComboBox where i have a remote JSON store, wich retrieves some records form a database.

My displayField is a "title" and my valueField is an integer (the ID of the record into the database).

I have the ComboBox into a form wich allows me to edit a record, i would like to show the "title" into the Combobox but send the ID when i save the form.

It seems that with Ext4 hiddenValue and hiddenName config parameters are no longer available, so: how to set the default value and the defaul label of a ComboBox field?

Looking in the forum and on the web i've found many examples that bind the 'load' event of the store and then match the record equal to my default value.

I don't thik that this solution is the best: if i have many ComboBox in my form it will create a lot of requests server-side to load the store just to set default values: it will slow down the loading of the form and create useless requests.

Another example: if we have an editable grid, we will have the same problem for each record of the grid!

So, my question: is possible to set the default value and the default label of a ComboBox having a remote store without loading it?

Thanks to all in advance.

12 Feb 2012, 4:44 AM
Anyone else have this problem?

It sounds strange for me remove this feature without replacing it with something new...


12 Feb 2012, 7:40 AM
There are to settings to combobox: displayField and valueField. Is this what you are looking for?

12 Feb 2012, 8:18 AM
The two settings you are saying are use when you read the store, but i need a configuration or method to set the default value and the default label without loading the store, expecially when the store is remote

21 Feb 2013, 1:28 AM
Hi all,

i have following situation:

I have toolbar on my grid. On toolbar i have buttons (Add, Edit and Delete). When i click on my Edit buttons i open Ext.Window which contains form with selected data pupulated. In that form i have combobox which is populated like this:
var item = Ext.getCmp('dataGrid').getView().getSelectionModel().getSelection()[0];
Ext.create('Ext.form.field.ComboBox', {
displayField: 'test',
fieldLabel: 'Server',
value: matchServerName(item.data.serverId),
store: getServers()

My problem is when I click save (submit form) form does not submit valueField it submites plain text and i get wrong data in my database (instead of id i get name)

Here is my Edit button code:

itemId : 'Edit',
text : 'Edit',
tooltip : 'Edit',
handler : function() {
var item = Ext.getCmp('dataGrid').getView().getSelectionModel().getSelection()[0];

Ext.create('Ext.Window', {
title : 'Edit',
width : 400,
height : 200,
plain : true,
layout : 'fit',
items : [{
xtype : 'form',
bodyPadding : 5,
flex : 1,
id: 'editData',
url: getCrudUri(),
defaultType : 'textfield',
name : 'id',
fieldLabel : 'id',
readOnly: true,
value: item.data.id
name : 'name',
fieldLabel : 'Name',
Ext.create('Ext.form.field.ComboBox', {
displayField: 'test',
fieldLabel: 'Server',
store: getServers()
name : 'type',
fieldLabel : 'Type',
value: item.data.type
name : 'oper',
fieldLabel : 'oper',
value: 'edit',
hidden: true
buttons : [{
text : 'Save',
handler : function(){
var form = Ext.getCmp('editData');
// params:{serverId: Ext.getCmp('serverCombo').setValue(item.data.serverId)},
success: function(form, action) {
Ext.Msg.alert('Success', "You successfuly edited balancer");
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.errors);