View Full Version : refresh combobox layout

11 Oct 2013, 3:50 AM
I have combobox which is loaded from local store( mode: 'local').
Store has 100 items and ComboBox shows them all.

When user clicks some button, i filter this store:

store.filter('Id', 4);

Now the store has 10 items instead of 100. But combobox still shows them all(100).
What should I do to refresh the combo box layout?
I have tried this:

but view is undefined.

If I reload the store it would work but I don't won't to reload the store from server.

If I copy store values to some other store and bind this store to combo box it should work,

but I guess there should be some more simple way to do that?

11 Oct 2013, 4:35 AM
Filtering should work automatically as you suggest, as seen in this demo:

(http://jsfiddle.net/Whinters/ahEUX/)Click to expand the combo, and it will include all records. Click the filter button, and it will filter the store so only one row remains. Expanding the combo again at this point only shows one record.

15 Oct 2013, 11:40 PM
Nice. It works in this example.
But in my case it doesn't work.

var storeWhTo = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: './storeData.aspx',
method: 'GET'
baseParams: { 'dataType': 5, upID: upID.toString() },
reader: new Ext.data.JsonReader({ id: 'whId', root: 'data' }, [{ name: 'whId', type: 'int' }, { name: 'whName', type: 'string'}]),
autoLoad: true

Store is loaded and it has also row with whId=4.

Then, If I call on button click to filter the store:

storeWhTo.filter('whId', 4);

Nothing happened. The row is still shown inside combo. Well, the store is filtered, but combo doesn't refresh.

var cmbWhTo = new Ext.ux.TwinCombo({
onTrigger2Click: function () {
trigger2Class: 'x-form-clear-trigger',
xtype: 'combo',
id: 'whTo',
name: 'whTo',
mode: 'local',
emptyText: 'WH to',
store: storeWhTo,
typeAhead: false,
triggerAction: 'all',
selectOnFocus: true,
displayField: 'whName',
valueField: 'whId',
width: 200

Any idea?

16 Oct 2013, 1:30 AM
I have found the answer :) This must be set on combobox to filter it the first time:

lastQuery: ''