gijgo icon indicating copy to clipboard operation
gijgo copied to clipboard

DatePicker - Infinite event loop (change, close ...) once value set

Open exstyle opened this issue 6 years ago • 4 comments

EDIT : Infinite event, when value is set (the bug occurs also with only one datepicker)). The event is also fired as soon as we click, so before the change (once the value has been set).

I believe it's the same bug.

Was working ok before i upgrade to 1.9.11 (can't remember which version i had before).

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Example</title>
  <script src="/Areas/Development/dist/libraries/jquery/jquery.js"></script>
  <script src="/Areas/Development/dist/modular/js/core.js" type="text/javascript"></script>
  <link href="/Areas/Development/dist/modular/css/core.css" rel="stylesheet" type="text/css">
  <link href="/Areas/Development/dist/modular/css/datepicker.css" rel="stylesheet" type="text/css">
  <script src="/Areas/Development/dist/modular/js/datepicker.js"></script>
</head>
<body style="padding: 8px;">
 <input id="datepicker1" width="312" />
 <script>
     $('#datepicker1').datepicker({
         change: function (e) {
             alert('Change is fired');
         }
     });
 </script>
</body>
</html>

exstyle avatar Dec 14 '18 11:12 exstyle

I have the same problem, but it only happens when i select multiple inputs like $('#input1, #input2'). Changing this to $('#input1').datepicker(); and $('#input2').datepicker(); works for me

kreilinger avatar Jan 09 '19 19:01 kreilinger

I can confirm this bug on 1.9.13, using the test: select: function (e, type) { alert('Select from type of "' + type + '" is fired'); }

I obtain infinite alert. Also with single input: $('#input').datepicker()

Se7enShawn avatar Aug 01 '19 12:08 Se7enShawn

Still present, will this ever be fixed?

Sonic1305 avatar Nov 11 '19 06:11 Sonic1305

@Sonic1305 @exstyle I have found a solution to this problem

$('#deliveryDate').datepicker({ format: 'dd/mm/yyyy', }); var lastValue = null; //or last value $("#deliveryDate").on("change", function(e) { if(lastValue !== e.target.value){ alert("hi") console.log(e.target.value) lastValue = e.target.value; }

Try it

Joicekurups avatar Apr 27 '21 09:04 Joicekurups