parmarmayur9090 / jquery-datepicker

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

Deselect does not work when using Mutiple Select with Input element #247

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Taking the example: 
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiple.ht
ml

If one adds an input element to the markup and applies the date-pick class to 
the input, the pop-up calendar does not appear to deselect dates when clicked 
after being selected (although the event triggers still fire correctly).

What is the expected output? What do you see instead?
Dates that are already selected, when clicked again, do not RemoveClass of 
"selected". 
This problem does not extend to the event triggers; the console output is 
firing a message of "Unselected" when clicked again.

Please provide a URL to a page displaying the problem.
http://mamascience.com/test/datepicker-test.html

What version of the datepicker are you using? On what operating system? And 
Which Browser?
jquery.datePicker.js 102 2010-09-13
Mac OS 10.6.4
Firefox 3.6.11

Please provide any additional information below.

Original issue reported on code.google.com by ryan%mam...@gtempaccount.com on 21 Oct 2010 at 6:08

GoogleCodeExporter commented 8 years ago
I just want to voice my support for a fix for this issue.  From the example 
given you can see that the unselect event is fired but the date is not removed 
from the selected dates array/object.  This makes it difficult to work around 
this issue.

Original comment by dylan.sp...@gmail.com on 9 Dec 2010 at 5:04

GoogleCodeExporter commented 8 years ago
The plugin doesn't natively support multi-select when added to an input. 
However, you can easily implement this yourself. Take the example linked to 
above and change the dpClosed to something like this:

function(e, selectedDates)
{
    var dateStrings = [];
    $.each(
        selectedDates,
        function(i, val)
        {
            dateStrings.push(val.asString();
        }
    );
    $('#id-of-your-input').value(dateStrings.join(','));
}

Hope it helps,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 9 Dec 2010 at 5:13

GoogleCodeExporter commented 8 years ago
Got it.  Thanks!

Original comment by dylan.sp...@gmail.com on 16 Dec 2010 at 5:01

GoogleCodeExporter commented 8 years ago

Original comment by kelvin.l...@gmail.com on 14 Apr 2011 at 7:42