Results 1 to 3 of 3

Thread: Help Applying Saved Filter To Grid

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    17
    Answers
    1
    Vote Rating
    1
      0  

    Default Help Applying Saved Filter To Grid

    I'm trying to let my users setup and save grid filters for later use.

    Getting and Saving the filters is easy enough:
    Code:
    var data = [];
    var filters = grd.getStore().getFilters();
    filters.each(function (filter) {
        data.push(filter.serialize());
    });
    Encode data and pass it up to the server to save it.
    But what I'm struggling with is reapplying that filter later down the road.
    Currently I am doing this:
    Code:
    var savedFilters = Ext.decode(rec.get('filter'));
    grid.filters.clearFilters();
    grid.getPlugin('gridfilters').addFilters(savedFilters);
    The savedFilter object is this:
    Code:
                 {
    
    
    • operator: "in"
    • property: "state"
    • value: ["TN"]
    • }
    But after calling addFilters the filter is not applied to the grid - nothing happens. It's possible I'm not fulling understanding what the 'addFilters' function does, but my assumption is that it should take the filter object (because it has a value property) and apply it to the grid. Does calling 'addFilters' only make the filter available for use, but not turn the filter on? Do I need to call a different method? I did try calling 'addFilter' for each item in the savedFilters array, but that yields the same results - nothing happens.

  2. #2
    Ext Team Member
    Join Date
    Sep 2017
    Posts
    500
    Answers
    2
    Vote Rating
    -201
      -1  

    Default

    Hi there- Sorry for the trouble! I have sent this issue over to my support team and they are looking into this. We will be in touch with you soon!

  3. #3
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    39
    Vote Rating
    -58
      -1  

    Default

    Hi
    I have created fiddle where you can load filter via AJAX
    Refrence Fiddle: https://fiddle.sencha.com/#view/editor&fiddle/2lgu

    Hope this will help you

    Thanks,
    Kumar

Similar Threads

  1. Issues after applying filter programmatically on grid
    By Kasi.sethu in forum Ext 5: Bugs
    Replies: 4
    Last Post: 15 Jul 2015, 6:18 PM
  2. Replies: 0
    Last Post: 4 Jun 2014, 6:05 PM
  3. Replies: 1
    Last Post: 18 Feb 2014, 1:33 PM
  4. Applying custom filter to ExtJS grid
    By Pravin.Pawar in forum Ext: Q&A
    Replies: 2
    Last Post: 17 Jan 2013, 4:11 PM
  5. Problem in Applying Grid-Filter
    By zeeshanhanif in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 26 May 2009, 9:22 PM

Posting Permissions

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