parmarmayur9090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Unable to deselect date by click when multiple=true #343

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Create a multi-select calendar. Open it, click on some dates. Try to click on 
them again to unset them.

What happens is that they get unset, and then in the change event, they get set 
again.

Looking for a fix.

Original issue reported on code.google.com by guy...@gmail.com on 27 Mar 2012 at 8:27

GoogleCodeExporter commented 8 years ago
The following changes appear to fix it:

change line 269 to read:

if (d && ! _getController(this).handlingSelected)

Then add the following two lines at the beginning and end of setSelected, 
respectively:

this.handlingSelected = true;

this.handlingSelected = false;

There may well be a more principled solution, but this got me going.

Original comment by guy...@gmail.com on 27 Mar 2012 at 8:38

GoogleCodeExporter commented 8 years ago
I was able to achieve the desired results by removing the else statement from 
the .bind('change', function() around line 274.

).bind(
    'change',
    function()
    {
        if (this.value == '') {
            controller.clearSelected();
        // Comented out to make deselect work (BE)
        // } else {
        //  var d = Date.fromString(this.value);
        //  if (d) {
        //      controller.setSelected(d, true, true);
        //  }
        }
    }
);

Original comment by bu...@butchewing.com on 13 Dec 2013 at 6:45