Open GoogleCodeExporter opened 8 years ago
I'm having a similar problem. I have a DatePicker with single selection and I
need to programatically unset the selected date when some button is clicked,
and it does not work.
I tried $('#datepicker').dpSetSelected(dpGetSelected()[0].toString()) and also
setting manually the date with no results.
Cheers!
Original comment by brafa...@gmail.com
on 15 Nov 2010 at 3:00
Hi,
Did you ever figure your problem out Aurelien? I must have missed this message
when it was posted...
@brafales - Try something more like
$('#datepicker').dpSetSelected($('#datepicker').dpGetSelected()[0], false);
(you need to pass in false to unselect the date and you need to call
dpGetSelected on a reference to the date picker....)
Original comment by kelvin.l...@gmail.com
on 15 Nov 2010 at 3:17
No, finally I never find a solution for that, sorry!
Original comment by Aurelien...@gmail.com
on 15 Nov 2010 at 3:31
Thanks Kevin, that worked, however, when I deselect a date, the event
dpSelectedDate is fired and this breaks some things for me. Is there any way to
know if the selection event was from a selection or from an unselection? Maybe
checking some parameter from the e or $td elements?
Original comment by brafa...@gmail.com
on 16 Nov 2010 at 8:20
@Aurelien:
It looks like it your code you are selecting one and deselecting the other date:
$('.date-picker').dpSetSelected(js_datedebut.asString(), true); // On
désélectionne la date dans le picker
$('.date-picker').dpSetSelected(js_datefin.asString(), false); // On
désélectionne la date dans le picker
Try passing false both times...
@brafales:
As described in the documentation, the dateSelected event has a status argument
passed to it:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/documentation.html
"dateSelected(event, date, $td, status) Triggered when a date is selected.
event is a reference to the event, date is the Date selected, $td is a jquery
object wrapped around the TD that was clicked on and status is whether the date
was selected (true) or deselected (false)"
Hope it helps,
Kelvin (not Kevin!)
Original comment by kelvin.l...@gmail.com
on 16 Nov 2010 at 9:57
p.s. I like you skin and implementation of the date picker Aurelien
Original comment by kelvin.l...@gmail.com
on 16 Nov 2010 at 9:58
Original issue reported on code.google.com by
Aurelien...@gmail.com
on 10 Mar 2010 at 3:58