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

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
vpiperi
Posts: 9
Joined: 2020-10-03 14:45

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

Post by vpiperi » 2020-10-19 16:47

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.

vpiperi
Posts: 9
Joined: 2020-10-03 14:45

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

Post by vpiperi » 2020-10-20 21:34

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...

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

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

Post by a.gneady » 2020-10-29 15:02

Please post the code you used to display the dropdowns.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

vpiperi
Posts: 9
Joined: 2020-10-03 14:45

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

Post by vpiperi » 2020-11-01 23:24

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);
     }
  });

});

vpiperi
Posts: 9
Joined: 2020-10-03 14:45

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

Post by vpiperi » 2020-11-06 21:17

...

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

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

Post by pbottcher » 2020-11-06 21:47

Try to catch with

Code: Select all

$j('button[name="NoFilter_x"]').on('click', function() { /*yourcode*/ });
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

vpiperi
Posts: 9
Joined: 2020-10-03 14:45

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

Post by vpiperi » 2020-11-06 22:20

pböttcher, you are AppGenius!
It works.
Thanks! :)

Post Reply