Author Topic: Filter dialog "Clear" & "Ok" button click event issue  (Read 433 times)

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Filter dialog "Clear" & "Ok" button click event issue
« on: March 28, 2023, 03:03:38 pm »
I am trying to add the javascript code below to track "Clear" & "Ok" button click event. The click event is working for "Clear" button but not for "Ok" button. Please advise.

Code: [Select]
$('body').on('click', '#tabs-filter button', function() {     
      console.log('Button clicked!');
});

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Filter dialog "Clear" & "Ok" button click event issue
« Reply #1 on: March 29, 2023, 07:05:26 am »
try this

Code: [Select]
document.body.addEventListener('click', function(evt){
if(evt.target.nodeName == "BUTTON" && evt.target.closest("#tabs-filter")){
alert("clicked");
}
}, true);

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Re: Filter dialog "Clear" & "Ok" button click event issue
« Reply #2 on: March 29, 2023, 12:07:01 pm »
Thank you, the event is working.

We have multiple dynamic Grid on the same screen using Goldenlayout.

I need the Paramquery Grid ID from where the filter popup opens when the user clicks the "Ok" or "Clear" button. Please advise.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Filter dialog "Clear" & "Ok" button click event issue
« Reply #3 on: March 29, 2023, 03:43:24 pm »
It doesn't seem feasible the DOM way because header filter menu is not attached to grid DOM.

Please try the documented beforeFilter and filter events.  Also beforeFilter event doesn't fire when grid.refreshDataAndView() is called  so that can help you differentiate between user initiated filtering and otherwise.

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Re: Filter dialog "Clear" & "Ok" button click event issue
« Reply #4 on: March 29, 2023, 07:39:20 pm »
Thank you. This event helps us to complete our required changes.