DataTables filter field has lost focus when overlaid on it

I am using dataTables jquery plugin on a table exposed with a loadable modal plugin. When I type in the data filter field, it has lost focus and I need to click inside it to type again. This behavior doesn't happen outside of the modal plugin, so I think the problem is with the communication between dataTables and the modal.

How can I solve this problem?

I am surfing the internet but I couldn't find an answer.

Thank you for your help!

Note. I am using Bootstrap 3.0.3 and dataTables 1.10.0

+3


source to share


1 answer


I have a similar problem. The bootstrap modal has a little latency and the modal gets focus faster than input.focus (). If doesn't work try over 500.
I fixed it:

var input = $('selectorYourDatatable input');
setTimeout(function(){
    input.focus();
}, 500);

      



Hope this will be helpful.

0


source







All Articles