PDA

View Full Version : Problem with ComboBox, loaded extra data



TayfunAlex
15 Apr 2013, 10:00 PM
Hello,
I have store


Ext.define('Shoro.store.OrderDays', {
extend: 'Ext.data.Store',
model: 'Shoro.model.OrderDay',
autoSync: true,
proxy: {
type: 'memory'
},
data: [{'id': 1, 'DayName':'Mo'},
{'id': 2, 'DayName':'Tu'},
{'id': 3, 'DayName':'We'},
{'id': 4, 'DayName':'Th'},
{'id': 5, 'DayName':'Fr'},
{'id': 6, 'DayName':'Sa'},
{'id': 7, 'DayName':'Su'}]
});


In controller I filter them, and assign, filtered data, to my ComboBox


...
var orderDays = this.getOrderDaysStore();
orderDays.clearFilter(true);
orderDays.filter(function(r){
var dayId = r.get('id');
var contains = false;
attendances.each(function(record, idx){
var attendanceDayId = record.get('DayOfTheWeek');
if (attendanceDayId == dayId){
contains = true;
}
});

return (contains==true)
});
dayOfWeekCombo.store = orderDays;
dayOfWeekCombo.show();


Filter work fine in console I see filtered data, but ComboBox load all data. And it happend only one time (I have one more combobox, filter connected with them. I select another value and all fine. All work correct.)

My view fragment for combobox

id: 'daysOfWeek',
xtype: 'combobox',
fieldLabel: 'Days',
labelWidth:110,
editable: false,
store: 'OrderDays',
valueField: 'id',
displayField: 'DayName',
listClass: 'x-combo-list-small',
hidden: true

slemmon
17 Apr 2013, 9:47 AM
In your controller could you instead get a reference to the combo and its's store and do the filtering directly on it?

dayOfWeekCombo.getStore().filter( ... );