Results 1 to 2 of 2

Thread: Problem with ComboBox, loaded extra data

  1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default Problem with ComboBox, loaded extra data

    Hello,
    I have store
    Code:
    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
    Code:
    ...
            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
    Code:
    id: 'daysOfWeek',
    xtype: 'combobox',
    fieldLabel: 'Days',
    labelWidth:110,
    editable: false,                
    store: 'OrderDays',
    valueField: 'id',
    displayField: 'DayName',                    
    listClass: 'x-combo-list-small',
    hidden: true

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505
    Vote Rating
    255
      0  

    Default

    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( ... );

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •