1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    10
    Answers
    2
    Vote Rating
    0
    DennisFLS is on a distinguished road

      0  

    Default Unanswered: Combobox should filter a store, but not its own

    Unanswered: Combobox should filter a store, but not its own


    Hi there,

    for an application, I want to use several comboboxes that are filled with their corresponding stores upon app start. Let's say I got two comboboxes and two stores for "teams" and "areas". These comboboxes should be displayed on top of my application and can be used to set a filter for the two stores whenever the user wants to, regardless of the current tab that is active.

    Technically, this works - my controller listens for the comboboxes change-event and filters the store. The problem is that if a filter is applied to the store, the combobox removes this item from its list.

    I know, this is not a fault but by design, but is there any option or any plugin that I can use to make the combobox use the unfiltered store? I don't want to "copy" my stores and let the comboboxes work with these copies because I would have to synchronize each of them (i.e. if I add a team in one store, it has to be added to the other).

    Thanks in advance

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,917
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    This issue is that you are filtering the store and bound to it .. you could make the combo stores an array and they simply place a load listener on the main store to use loadData(records) to update the combo's array store.

    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    10
    Answers
    2
    Vote Rating
    0
    DennisFLS is on a distinguished road

      0  

    Default


    Thanks for the hint, got on the right track after reading it.

    At first, I extended Ext.data.Store to give its contents as an array:
    PHP Code:
        getAsArray: function( keyFieldvalueField ) {
            var        
    me this,
                    
    = [];
            
            for ( var 
    0me.getCount(); i++ ) {
                
    a.push( [ me.getAt).getkeyField ), me.getAt).getvalueField ) ] );
            }
            
            return 
    a;
        } 
    So, for records like usergroups with the properties id and name (my stores have more properties so I had to include the keys as parameters) I can build my combobox like this ("this" refers to my current view):
    PHP Code:
                {
                    
    xtype'combobox',
                    
    name'filterGroups',
                    
    fieldLabel'Groups',
                    
    editablefalse,
                    
    displayField'Name',
                    
    multiSelecttrue,
                    
    queryMode'local',
                    
    storemyApp.getUserGroupsStore().getAsArray'id''name' ),
                    
    emptyText'all',
                    
    valueField'id',
                    
    listeners: {
                        
    change: function( comboboxvalue ) {
                            
    this.fireEvent'filterselectionchanged'comboboxvaluethis.initialConfig.valueField );
                        }
                    }
                }, 
    My FilterController listens for the event and applies the filter for the given key. Because I want to be able to filter several stores by several keys AND several stores by the same key, I had to combine the filter criterias in a loop when the event got fired. I still have to make sure that the combobox reads changes that have been made to the store though...

    It seems like a pretty dirty solution to me, but it works as expected

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi