How to identify the Asc/Des sort click within the filterChanged event handler

Posted by: bhavya.chandra on 15 April 2020, 7:31 am EST

    • Post Options:
    • Link

    Posted 15 April 2020, 7:31 am EST

    When applying the column filter ascending or descending sort, how can I trigger the condition within the filter.filterChanged.addHandler.

    sheet.filter.filterChanged.addHandler(function (s, e) {

    me.formatSheet(sheet);

    });

  • Posted 16 April 2020, 1:34 am EST

    Hi Bhavya,

    In the filterChanging event, get the reference to the current ColumnFilterEditor and handle its buttonClicked event:

    formatSheet.filter.filterChanging.addHandler((s, e) => {
      var editor = s.activeEditor;
      editor.buttonClicked.addHandler(editor => {
        var btn = wjcCore.getActiveElement();
        var btnType = btn.getAttribute('wj-part');
        if(btnType === "btn-asc") {
          alert('ascending');
        }
        else if(btnType === "btn-dsc") {
          alert('descending');
        }
      })
    })
    

    Please refer to the sample link below for reference:

    https://stackblitz.com/edit/angular-qoiysb

    Regards,

    Ashwin

  • Posted 16 April 2020, 8:50 am EST

    Hi Ashwin,

    Thanks for quick response and solution is working fine.

    Thanks and Regards,

    Bhavya

Need extra support?

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

Learn More

Forum Channels