CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to select multiple dates, say 2 weeks including the clicked date?

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q.
View previous topic :: View next topic  
Author Message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri Dec 30, 2005 11:43 pm    Post subject: How to select multiple dates, say 2 weeks including the clicked date? Reply with quote

There is a call-back function in the plugins.js called fIsSelected(y,m,d), which determines whether to mark the passed-in date as a selected date.

If this function returns true, the specific date passed in will be marked as selected using theme options giMarkSelected, gcFGSelected, gcBGSelected and guSelectedBGImg.

To select multiple dates, you just need to create an array in the plugins.js to store either the selected dates or the selected date range. This array may get assigned via fOnChange() or fAfterSelected() plugin, then being checked from within the fIsSelected().

e.g. put the following code in plugins.js. The selected dates will be stored in the _duration array in the container HTML (you may add more code to fAfterSelect() to parse the array into a hidden form field so that it can be submitted to the server):
Code:
var _durationDays=14;

function fAfterSelected(y,m,d,e) {
  var dt=new Date(y, m-1, d);
  if (!gContainer._duration)
    gContainer._duration=[];
  for (var i=0; i<_durationDays; i++) {
    gContainer._duration[i]=[dt.getFullYear(), dt.getMonth()+1, dt.getDate()];
    dt.setDate(dt.getDate()+1);
  }
  fRepaint(); // refresh the panel
}

function fIsSelected(y,m,d) {
  if (!gContainer._duration) return false;
  var dur=gContainer._duration;
  for (var i=0; i<dur.length; i++) {
    if (y==dur[i][0]&&m==dur[i][1]&&d==dur[i][2])
      return true;
  }
  return false;
}

You may find other examples in the MultiPicker demo in FlatCalendarXP or the WeekPicker demo in PopCalendarXP.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q. All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group