0

Can someone check the way how I combine the two functions to work for my datepicker. Thanks.

Clicking the header, make me select all the dates for that day for the entire month

selectColumn: function(picker, inst) {
           var target = $(this);
           picker.find('div.datepick-month th span').each(function() {
               $('<a href="javascript:void(0)" class="' +
                       this.className + '" title="Select all of these days">' +
                       $(this).text() + '</a>').
                   click(function() {
                       var dates = $('div.datepick-month td:nth-child(' +
                           ($(this).parent().index() + 1) +
                           ') a:not(.datepick-other-month)', picker);
                       dates = dates.map(function(i, elem) {
                           return target.datepick('retrieveDate', this);
                       }).get();
					   $.merge(dates, target.datepick('getDate'));
					   target.datepick('clear').datepick('setDate', dates);
                   }).
                   replaceAll(this);
           });
       },

Clicking the week number gets me to select the entire week

selectWeek: function(picker, inst) {
		var target = $(this);
		picker.find('td.datepick-week span').each(function() {
			$('<a href="javascript:void(0)" class="' +
					this.className + '" title="Select the entire week">' +
					$(this).text() + '</a>').
				click(function() {
					var date = target.datepick('retrieveDate', this);
					var dates = [date];
					for (var i = 1; i < 7; i++) {
						dates.push(date = $.datepick.add($.datepick.newDate(date), 1, 'd'));
					}
					if (inst.get('rangeSelect')) {
						dates.splice(1, dates.length - 2);
					}
					target.datepick('setDate', dates).datepick('hide');
				}).
				replaceAll(this);
		});
	},

and here is how I do it on my main page:

$('selectedWeekPicker').datepick({
renderer: $.datepick.weekOfYearRenderer,
firstDay: 1, showOtherMonths: true, rangeSelect: true,
onShow: $.datepick.selectColumn, onShow: $.datepick.selectWeek, showTrigger: '#calImg'});

I just help to modify this thanks

1
Contributor
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ekseks
0

basically what I'm trying to arrive here is to call the two functions at the same time with the onShow function, is that ever possible? it will be used for a datepicker thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.