dataSource.filter running twice

2 posts, 0 answers
  1. Bridge24
    Bridge24 avatar
    65 posts
    Member since:
    Jan 2009

    Posted 15 Jun 2018 Link to this post

    In our app, we are using "custom filtering", as we set our own function in the "operator" property of the filter.

    I found, that, every operator is called twice.  If I have 10 rows to filter, and 1 operator set for 1 specific filter, it runs 20 times, from 1 to 10, and again from 1 to 10.

    Steps to reproduce:

    After some investigation, I found this:

    In your "query" function, you run this: 

    (copied from the minified version + chrome prettyPrint in F12)
    result = this._queryProcess(this._data, this._mergeState(options)); 

    The filter is applied.

    Then, a few lines later, that:

    this._aggregateResult = this._calculateAggregates(this._data, options);

    And, from that line, the whole filtering is applied again.

    When we have only a few lines to filter, it's quick. 

    But with 5000 rows of 10 filters per row, running it twice is a good difference in cpu, memory and time!

    You can look at my dojo sample, it's easy to reproduce.


  2. Stefan
    Stefan avatar
    2240 posts

    Posted 18 Jun 2018 Link to this post

    Hello, Daniel,

    Thank you for the example and all of the details.

    This occurs because the filter is called again when the aggregates are calculated.


    I will forward this to the developers' team to check if we can only execute the second filter if there are aggregates or grouping.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top