Ext 4.1.1: add a new entry to the store

I want to add entries after initializing the store.

I tried loadData () , loadRawData () , add () , but nothing works.

Here is my jsfiddle: http://jsfiddle.net/charlesbourasseau/zVvLc

Any ideas?

+6
source share
1 answer

You need to set queryMode: 'local' in the combo box. Minimal example:

 Ext.onReady(function() { var store = Ext.create('Ext.data.Store', { alias: 'store.ModeStore', autoLoad: false, fields: [{ name: 'mode', type: 'string' }, { name: 'id', type: 'string' }], data: [{ mode: 'mode1', id: 1 }] }); var container = Ext.create('Ext.form.field.ComboBox', { renderTo: Ext.getBody(), displayField: 'mode', valueField: 'mode', store: store, queryMode: 'local' }); store.add({ mode: 'mode2', id: 2 }); }); 
+13
source

Source: https://habr.com/ru/post/920886/


All Articles