Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery datepicker input not loosing focus on chrome

I have an input that is using jQuery UI datepicker, upon selecting a date the datepicker closes and then i make an ajax call to get some data back and refresh a datagrid.

Somehow, after the datagrid finishes refreshing the datepicker auto open's. I'm presuming the input never lost focus and there for the datepicker triggers. This only happens in chrome. Is there a way to stop this from happening ?

I've tried forcing .blur() upon closing the datepicker, but that didn't work

$(".datePickerEnable").datepicker({
            dateFormat:"dd-mm-yy",
            changeMonth: true,
            changeYear: true,
            dayNames: [ "Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sabado" ],
            dayNamesMin: [ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" ],
            monthNames: [ "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" ],
            onClose: function() {
                this.blur();
            }
        })

Doing document.activeElement after the datagrid refresh shows that the input is still focused.

like image 683
mfreitas Avatar asked Jan 18 '26 06:01

mfreitas


1 Answers

On the formUtils.js comment the lines 5736 to 5739.

like image 190
Diogo Cardoso Avatar answered Jan 20 '26 20:01

Diogo Cardoso