Override default wijmo filter and sorting methods

Posted by: karanpreet.singh on 20 August 2020, 1:00 pm EST

  • Posted 20 August 2020, 1:00 pm EST

    Hey Team,

    Is there a way to override the default filtering and sorting of wijmo flex grid in angular2. I want to update the data myself on filter and sort change.

  • Posted 21 August 2020, 2:55 am EST

    Hi Karanpreet,

    There is no direct way to override filtering and sorting. To override the filtering in the grid, you will have to override the apply method of FlexGridFilter:

    const _oldApply = gridFilter.apply;
    // use the function keyword and not the arrow functions
    // to save the this scope
    gridFilter.apply = function() {
    	// your custom implementation
    	// call the original method like this
    	// _oldApply.call(this);
    }
    

    This will override the apply for each of the column. You can also override each column separately:

    var colFilter = gridFilter.getColumnFilter('country');
    const _oldApply = colFilter.apply;
    colFilter.apply = function(value) {
    	// implementation
    	// call the original method
    	// _oldApply.call(this, value):
    }
    

    In sorting, there is no direct apply method. But, there is a sortComparer property which can be used to provide custom implementation on how to sort 2 values. This property is a part of CollectionView since sorting is applied on collection view and not the grid.

    Example: https://www.grapecity.com/wijmo/api/classes/wijmo.collectionview.html#sortcomparer

    I hope this helps.

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels