Date-picker widget 1.0

Just updated the date-picker widget to 1.0, with customizable date-filtering. See the wiki for more information.

Trackback URL for this post:

http://www.tigretigre.com/trackback/7

Tigretigre

[...] something about tigretigre[...]

Comments

External control

Hello;

I like open the popup clicking on a image(externalControl) at right of date input . How do it?

thank in advance

External control

See the wiki page on the DatePicker object, but the short answer is, instantiate the DatePicker while passing in the id of the image element as the externalControl parameter, e.g.:

<input type="text" id="date" name="date">
<img id="img" src="date.png">
<script>
var picker = new DatePicker({
relative:'date',
externalControl:'img',
});
</script>

widget demo

Can you provide a live demo of the widget? I cannot find it, neither here nor on your google project site.
Thanks

Demo

I just uploaded the test.html from the source repo to http://www.tigretigre.com/datepicker/test.html so you can see a very simple use case. This one limits the date range to between 1.5 days in the future and 60 days in the future, and excludes weekends.

DatePicker

Thanks for this great widget! I have a question about the callback functions, they don't seem to be working for me on the "cellCallback" event but it does get called onpageload. Can you tell me what I'm doing wrong? Thanks, my code is below;

var dpck_fieldname = new DatePicker({
relative:'EventDate',
keepFieldEmpty:true,
cellCallback:Events.getMyEvents(),
dateFilter:DatePickerUtils.noDatesAfter(0)
});

Sorry for the slow response

This comment kinda escaped my attention for a bit. Anyway, the problem is you are not passing the callback function so much as the value of the function after it gets called. You want something like:

var dpck_fieldname = new DatePicker({
relative:'EventDate',
keepFieldEmpty:true,
cellCallback:Events.getMyEvents,
dateFilter:DatePickerUtils.noDatesAfter(0)
});

Notice no parentheses after getMyEvents.