-
Notifications
You must be signed in to change notification settings - Fork 0
Description
With the event listener listening for click events on the top level document, then checking if the event was inside a searchable table, and then toggling the search input if the click coordinates are OUTSIDE the table, is causing some difficulty in certain situations.
For example, I would like to have my search icon inside the table caption. I can move it there with CSS, but then the click logic breaks because the click coordinates are inside the table
It also causes issues when using together with your sortable plugin and wanting to restore saved column sort orders.
For sortable, I save the sorting column in local storage and then restore the sort column like suggested by the sortable plugin by doing a th.click() on the column to sort. Problem is that the default coordinates for generating a simple click event like this is (0,0) which will almost always be outside the table while the click event was on the th inside the table - this then causes the search input to always be toggled open as soon as saved sort order is restored.
A workaround for this is by dispatching a click event on the th but forcing the click coordinates to be on th element, this failing the searchable event logic expecting the coordinates to be outside the table and not toggling the search input.
I wonder if it would be an option to change the event listener logic to listen on the actual search icon element attached to the table and not assume this element to be outside the table and then needing to look at the click coordinates?
Otherwise I love both plugins for their simplicity - thanks!