View Full Version : Problem in insert method of the store

23 Jul 2013, 12:49 PM
A problem was encountered in the insert method of the store at the time inform the index and the information is not included in the index posted.

Observing the code below can be seen the problem of inserting an information '-------' should be inserted at position 0, but is added at the end of the list.

/*global Ext:false */
Ext.onReady(function () {
// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [{
"abbr": "AL",
"name": "Alabama"
}, {
"abbr": "AK",
"name": "Alaska"
}, {
"abbr": "AZ",
"name": "Arizona"

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody()
states.insert(0, {
'abbr' : null,
'name': '------'

23 Jul 2013, 11:34 PM
If the insert is moved above the create function for combo, then it works fine. This seems to be a bug.

If you have to load store data from your backend and have to add some static entries at the end, one workaround could be to add a listener for the load event of store and then add the static entries to the end using store.add()

25 Jul 2013, 10:21 AM
Using your test case I see the issue in 4.2.0, but it appears to be fixed in 4.2.1.