Page 1 of 1

How to add custom action to [Show All] button?

Posted: 2020-10-19 16:47
by vpiperi
Hi to all!

Need to catch click event of this button to set custom dropdown filters to their default values.
Is it possible at all?

Thanks.

Re: How to add custom action to [Show All] button?

Posted: 2020-10-20 21:34
by vpiperi
https://imgur.com/q7CyFdG
After pressing 1 [Show All] want to set both dropdown lists 2, 3 to their default values.

Code: Select all

jQuery('#NoFilter').on('click', function (){
  //some code
}
doesn't work...

Re: How to add custom action to [Show All] button?

Posted: 2020-10-29 15:02
by a.gneady
Please post the code you used to display the dropdowns.

Re: How to add custom action to [Show All] button?

Posted: 2020-11-01 23:24
by vpiperi

Code: Select all

jQuery(function changeStatus (){

  var str1 = '<select class="btn btn-default" name="status_flt" id="status_flt">';
      str1 = str1 + '<option value="">All Statuses</option>';
      str1 = str1 + '<option value="Onboarding">Onboarding</option>';
      str1 = str1 + '<option value="Active">Active</option>';
      str1 = str1 + '<option value="Offboarded">Offboarded</option>';
      str1 = str1 + '<option value="On_leave">On leave</option>';
      str1 = str1 + '</select>';

  jQuery('#Filter').after(str1);

  jQuery('#status_flt').on('change', function() {
    var empl_Status = document.getElementById('status_flt').value;
    localStorage.setItem('status_flt_value', empl_Status);
    var filter_field = 11;
    var url = encodeURI('Employee_Directory_view.php?FilterField[1]=' + filter_field + '&FilterOperator[1]=like&FilterValue[1]=' + empl_Status);
    window.open(url, '_self')
  });

  jQuery(document).ready(function() {
    if (jQuery('#status_flt').length) {
      var saved_val = (localStorage.getItem('status_flt_value'));
      jQuery('#status_flt').val(saved_val);
     }
  });

});

Re: How to add custom action to [Show All] button?

Posted: 2020-11-06 21:17
by vpiperi
...

Re: How to add custom action to [Show All] button?

Posted: 2020-11-06 21:47
by pbottcher
Try to catch with

Code: Select all

$j('button[name="NoFilter_x"]').on('click', function() { /*yourcode*/ });

Re: How to add custom action to [Show All] button?

Posted: 2020-11-06 22:20
by vpiperi
pböttcher, you are AppGenius!
It works.
Thanks! :)