PDA

View Full Version : [OPEN] Store + ComboBox synchronization



vxviper
30 Jul 2011, 1:05 AM
Let's say I have a ComboBox backed by a Store, with a given record selected. When updating the record (specifically the attribute being shown by the combo box) through the store's proxy, the value being shown in the field won't change.

If the record is hidden (not currently selected in the combo box) then the update operation works correctly.

This can be avoided by forcing the combo to re-select the record after the update, but it shouldn't be this way.

stevil
30 Jul 2011, 4:57 AM
Since there's more than one way to get a value into a store's record, it would be helpful to see a code sample of the update you're doing. Also, there's a sticky thread in this forum with a template to fill out for a bug report, that will give the dev team a better chance at addressing this.

stevil

Dr. Flink
31 May 2012, 1:10 AM
I've experienced the same problem.

REQUIRED INFORMATION

Ext version tested:

Ext 4.1.0

Browser versions tested against:

Chrome 19 (Windows)
IE9

Description:

Change of record value is not displayed in combos input field, only in the dropdown list when the change is made on the selected record.
Steps to reproduce the problem:

Create an Ext.form.field.ComboBox. Select a record in the dropdown list. Update the same record value.
The result that was expected:

The input fields value is updated to the new record value.
The result that occurs instead:

The input fields value is not updated.
Test Case:

Code:


Ext.onReady(function() {
// The data for all states
var states = [
{"abbr":"AL","name":"Alabama","slogan":"The Heart of Dixie"},
{"abbr":"AK","name":"Alaska","slogan":"The Land of the Midnight Sun"},
{"abbr":"AZ","name":"Arizona","slogan":"The Grand Canyon State"},
{"abbr":"AR","name":"Arkansas","slogan":"The Natural State"},
{"abbr":"CA","name":"California","slogan":"The Golden State"}
];

// Define the model for a State
Ext.regModel('State', {
fields: [
{type: 'string', name: 'abbr'},
{type: 'string', name: 'name'},
{type: 'string', name: 'slogan'}
]
});

// The data store holding the states
var store = Ext.create('Ext.data.Store', {
model: 'State',
data: states
});

// Simple ComboBox using the data store
var simpleCombo = Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Select a single state',
renderTo: Ext.getBody(),
displayField: 'name',
value: 'Alabama',
width: 500,
labelWidth: 130,
store: store,
queryMode: 'local',
editable: false,
autoSelect: false
});

var button = Ext.create('Ext.button.Button', {
renderTo: Ext.getBody(),
text: 'Update',
handler: function(btn) {
// Get selected record
var record = store.findRecord('name', simpleCombo.getValue());
// Update record
record.set('name', 'Foo');
// Workaround
//simpleCombo.setValue(record);
}
});
});


HELPFUL INFORMATION


Screenshot or Video:

35774

Debugging already done:

none
Possible fix:

You can reselect the combo value to update it's value as a workaround.
Additional CSS used:

only default ext-all.css
Operating System:

Windows 7

rsqw
5 Jul 2012, 5:36 AM
Any news about this bug?