[CLOSED] GridPanel Filter with Checked Selections

  1. #1

    [CLOSED] GridPanel Filter with Checked Selections

    I have a GridPanel using a CheckboxSelectionModel with a text filter that displays matches from the store as you type:
    Click image for larger version. 

Name:	grid_filter.PNG 
Views:	18 
Size:	5.5 KB 
ID:	6732

    This is the js function that is executed to apply the text filter:
    function ApplyTextFilter(sender, textField) {
        var grid = Ext.getCmp(sender);
        var dataIndex = grid.getId().replace("_Grid", "");
    
        var store = grid.getStore();
    
        store.filterBy(function (record) {
            var value = textField.getValue() || "";
            var val = record.get(dataIndex).toLowerCase();
            return val.indexOf(value.toLowerCase()) > -1;
        }
        );
    }
    The problem is that when I make checkbox selections, and then apply a new text filter, I lose the previous selections. I want to be able to keep the current selections as I search new text. This is a mockup of what I mean:
    Click image for larger version. 

Name:	mockup.PNG 
Views:	19 
Size:	15.4 KB 
ID:	6733

    Any solutions or alternative suggestions would be so appreciated. :) Thanks!
    Last edited by Baidaly; Aug 09, 2013 at 8:17 PM. Reason: [CLOSED]
  2. #2
    Hello!

    How do you load your data? Is it local or remote? We would appreciate a full sample to test.
  3. #3
    Remote. The store is loaded with json data from a web service. This is the response from Fiddler (without any text filter applied):

    [{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 1950"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 2600"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 2650"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 2900"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 2950"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 6850"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE 6950"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE R510"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE R710"},{"RECORD_COMPONENT_NAME":"DELL POWEREDGE R720"},{"RECORD_COMPONENT_NAME":"FUJITSU PRIMEPOWER 450"},{"RECORD_COMPONENT_NAME":"FUJITSU PRIMEPOWER 650"},{"RECORD_COMPONENT_NAME":"FUJITSU PRIMEPOWER 850"},{"RECORD_COMPONENT_NAME":"FUJITSU SPARC ENTERPRISE M4000"},{"RECORD_COMPONENT_NAME":"FUJITSU SPARC ENTERPRISE M5000"},{"RECORD_COMPONENT_NAME":"HP BLADESYSTEM BL25P"},{"RECORD_COMPONENT_NAME":"HP BLADESYSTEM C7000"},{"RECORD_COMPONENT_NAME":"HP BLP ENCLOSURE (243564-B21)"},{"RECORD_COMPONENT_NAME":"HP PROLIANT BL460C"},{"RECORD_COMPONENT_NAME":"HP PROLIANT BL460C G6"},{"RECORD_COMPONENT_NAME":"HP PROLIANT BL460C G7"},{"RECORD_COMPONENT_NAME":"HP PROLIANT BL685C G6"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL360 G5"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL360 G7"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380 G3"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380 G4"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380 G5"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380 G6"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380 G7"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL380P GEN8"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL580 G2"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL580 G3"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL580 G7"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL585"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL585 G2"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL585 G5"},{"RECORD_COMPONENT_NAME":"HP PROLIANT DL585 G6"},{"RECORD_COMPONENT_NAME":"IBM BLADECENTER CHASSIS (8677-2XX)"},{"RECORD_COMPONENT_NAME":"IBM BLADECENTER HS20"},{"RECORD_COMPONENT_NAME":"IBM P5 P520"},{"RECORD_COMPONENT_NAME":"IBM P6 P550"},{"RECORD_COMPONENT_NAME":"IBM P6 P560"},{"RECORD_COMPONENT_NAME":"IBM P7 P750"},{"RECORD_COMPONENT_NAME":"IBM X3650 M3"},{"RECORD_COMPONENT_NAME":"IBM X3750 M4"},{"RECORD_COMPONENT_NAME":"IBM XSERIES 335"},{"RECORD_COMPONENT_NAME":"IBM XSERIES 336"},{"RECORD_COMPONENT_NAME":"IBM XSERIES 346"},{"RECORD_COMPONENT_NAME":"IBM XSERIES 360"},{"RECORD_COMPONENT_NAME":"NICE VOICE LOGGER"},{"RECORD_COMPONENT_NAME":"SUN ENTERPRISE 420R"},{"RECORD_COMPONENT_NAME":"SUN SPARC ENTERPRISE M4000"},{"RECORD_COMPONENT_NAME":"SUN SPARC ENTERPRISE M5000"},{"RECORD_COMPONENT_NAME":"SUN SPARC ENTERPRISE M8000"},{"RECORD_COMPONENT_NAME":"SUN SPARC ENTERPRISE T5220"},{"RECORD_COMPONENT_NAME":"SUN SPARC ENTERPRISE T5240"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE 280R"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE 6800"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE E2900"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE T2000"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V1280"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V210"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V240"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V440"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V480"},{"RECORD_COMPONENT_NAME":"SUN SUN FIRE V490"},{"RECORD_COMPONENT_NAME":"SUPERMICRO SC512L-200"},{"RECORD_COMPONENT_NAME":"SUPERMICRO SC823S-R500RC"},{"RECORD_COMPONENT_NAME":"SUPERMICRO X7DB8"},{"RECORD_COMPONENT_NAME":"TOSHIBA FR2100A MODEL 100"}]
  4. #4
    You can do the following:

    Save your selections:
    s = App.GridPanel1.getSelectionModel().getSelection();
    And restore them after your after filtration:
    App.GridPanel1.getSelectionModel().select(s);
  5. #5
    That worked great. Thanks!

Similar Threads

  1. Replies: 7
    Last Post: Mar 12, 2013, 8:15 AM
  2. Replies: 2
    Last Post: May 01, 2012, 4:57 PM
  3. Replies: 3
    Last Post: Feb 16, 2012, 4:26 PM
  4. Replies: 0
    Last Post: Sep 26, 2011, 12:20 PM
  5. Clear selections of gridpanel
    By onurbozkurt in forum 1.x Help
    Replies: 4
    Last Post: Aug 19, 2009, 5:00 PM

Tags for this Thread

Posting Permissions