code-and-effect / effective_datatables

An effective ActiveRecord to Datatables dsl for Ruby on Rails. Make intelligent tables quickly.
MIT License
133 stars 36 forks source link

Filter does not search when pasting a text using just mouse #145

Closed Nerian closed 3 years ago

Nerian commented 3 years ago

Hi,

I noticed that when a user uses only the mouse to copy and paste into a search box in a column, it does not execute the search correctly. There appears a box with the "Processing" info, but the data is not updated. I kept digging and I found this by analysing the network:

This is the request that gets done when the user pastes the text in the box using the mouse (right click on the box and clicking on paste). There appears a box with "Processing" and data is updated as if no filters were applied. Notice that in fact the pasted text does not appear in the value sent to server.

Captura de pantalla 2021-01-15 a las 17 39 58

And here is the correct request. This happens when the users writes the text, or copy and paste using keyboard shortcuts. The value do get set.

Captura de pantalla 2021-01-15 a las 17 40 13

So maybe there is some javascript listen event missing? Can we listen to mouse click perhaps? Or change event in the input?

Thanks!

matt-riemer commented 3 years ago

Hey very interesting

https://github.com/code-and-effect/effective_datatables/blob/master/app/assets/javascripts/effective_datatables/initialize.js.coffee#L154

This is where all the javascript search events are set up. Probably not as simple as it could be.

It uses the delayedChange javascript library to throttle changes.