PDA

View Full Version : [4.2.3] Added items to combobox store not shown



Werzi2001
16 Jul 2015, 4:48 AM
Ext version tested:

Ext 4.2.3

Browser versions tested against:

FF
Chrome

Description:

Added items to the store of the combobox before the combobox was opened at least once are not shown in combobox.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<link rel="stylesheet" type="text/css" href="./extjs/resources/css/ext-all-gray.css"/>
<script type="text/javascript" src="./extjs/ext-all.js"></script>

<script type="text/javascript">
var counter = 1;
Ext.onReady(function() {
var combo = Ext.create('Ext.form.ComboBox', {
renderTo: document.body,
width: 200,
value: 1,
valueField: 'value',
displayField: 'display',
triggerAction: 'all',
typeAhead: true,
forceSelection: true,
mode: 'local',
store: Ext.create('Ext.data.ArrayStore', {
fields: ['value', 'display'],
data: [
[counter, 'Entry ' + (counter++)]
]
})
});

var button = Ext.create('Ext.button.Button', {
renderTo: document.body,
text: 'Click me',
listeners: {
click: function(btn, e, eOpts) {
combo.getStore().add({
value: counter,
display: 'Entry ' + (counter++)
});
}
}
});
});
</script>
</head>
<body>
</body>
</html>

Steps to reproduce the problem:

Use button to add new items to the combobox before the combobox is opened
Open combobox
Add further items to the combobox using the button

The result that was expected:

All items are shown in the combobox

The result that occurs instead:

Only the items added after the combobox was opened are shown
Items added before are missing