Results 1 to 2 of 2

Thread: Paging grid filter issue with local( memory ) store;

  1. #1
    Sencha User
    Join Date
    Jun 2016
    Posts
    6

    Default Paging grid filter issue with local( memory ) store;

    Hi all,

    I need to create complex filter function for grid with paging and local(memory) store.
    I am using store.filterBy() method to provide custom function for filtering.
    After this it crashed with following error:

    HTML Code:
    Uncaught Error: Unable to use a filtering function in conjunction with remote filtering.
    However, filter works properly when I am using store.setFilters method with array of objects({property:..., value:....});

    People suggest to use "remoteFilter" option for paging grid to avoid problems, so here is a part of my store config ;
    Code:
              pageSize: 2, 
              remoteFilter: true,
                proxy: {
                    type: 'memory',
                    enablePaging: true,
                    reader: {
                        type: 'json',
                        rootProperty: 'items'
                    }
    Are there any ideas how can I apply filter function to store for grid with pagination?

    I have created an example in the fiddle to describe the issue: https://fiddle.sencha.com/#fiddle/2u65

    Thank you in advance,
    A.

  2. #2
    Sencha User
    Join Date
    Jun 2016
    Posts
    6

    Default

    I have found a solution for my problem.

    Mentioned error raised in onFilterEndUpdate method of Store which explicitly check existence of filter function:


    Code:
    ...
    me.getFilters().each(function(filter) {
      if (filter.getInitialConfig().filterFn) {
        Ext.raise('Unable to use a filtering function in conjunction with remote filtering.');
      }
    });
    ...
    So, I have override this method in my store entity and commented out these lines.

    In general solution consists of following actions:

    1.
    Configure store with
    Code:
    remoteFilter: true, pageSize: 5
    and its memory proxy with
    Code:
    enablePaging: true
    2. Load data into the store using its Proxy instead of loadData method:

    Code:
    store.getProxy().data = this.getSimpsonsData().items;
    store.reload();
    3. Override method onFilterEndUpdate after store initialization and comment out mentioned lines.


    After this grid with paging toolbar works properly.

    For more details see:
    https://stackoverflow.com/questions/...tore-in-extjs6
    or workable live example in fiddle:
    https://fiddle.sencha.com/#fiddle/2ub7

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
  •