View Full Version : Reset combobox when forceSelection = true and user can edit the combobox

13 Nov 2013, 8:53 PM
I have a combobox which have a config 'forceSelection: true'. User can edit the combobox, for example: type in arbitrary text, then immediately click the reset button to reset the combobox but the combobox won't reset to its original value. How could I fix this?

Here's my code to describe the problem:

var states = Ext.create('Ext.data.Store', {

fields: ['abbr', 'name'],

data : [

{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}

Ext.create('Ext.container.Container', {

layout: 'hbox',

margin: '50',

renderTo: Ext.getBody(),

items: [
xtype: 'combobox',
margin: '0 10 0 0',
fieldLabel: 'Choose State',
forceSelection: true,
store: states,
queryMode: 'local',
value: 'AL',
displayField: 'name',
valueField: 'abbr'

xtype: 'button',
text: 'reset',
handler: function () {

14 Nov 2013, 5:33 AM
reset will change the value to the one that you initially specified with the value config.
in your case Alabama.

if you want an empty value instead, change your code like this:


14 Nov 2013, 6:54 PM
Thanks tobiu, but your answer don't solve my problem.

It's weird that when I reset the combobox with :


or when I set its value to 'Alabama' with:


The combobox both reset to blank. I expect it to reset to my original value 'Alabama'. Is it a bug of Ext 4.1?