Why I need to upgrade
I need to have the feature of disabling of navigating to dates past some date, so I am considering upgrading from jscalendar (http://www.dynarch.com/projects/calendar/old/) to jscal2 (http://www.dynarch.com/projects/calendar/) in my project. But in homepage and documentation of the new jscal2, following things are mentioned -
请注意,这是一个全新的产品。
请注意,这不符合我们原来的日历项目。
Problem
So, I am confused, if an upgrade with minimal changes in my current project is possible and if so how exactly to do that. I have already posted a comment in the site - http://www.dynarch.com/projects/calendar/discussion/ and waiting for some reply. In the meantime, I thought those who have used the product might be able to help, so here is my question.
我现有项目代码使用jpanndar版本 1.51(见日历.js,v 1.51)。 这些助手代码有几行,其中包括<代码>功能显示Calendar(,其中var cal = 新的日历(
)。
function setActiveStyleSheet()
function selected()
function closeHandler()
function showCalendar(){
...
//some lines of code
...
var cal = new Calendar(1, null, selected, closeHandler);
...
//some lines of code
...
}
....
www.un.org/chinese/ga/president
但我看不到今天我下载的新版本的mos。 我试图删除旧版本的所有js/cs档案,包括新版本的档案,但只保留同样的jplndar.js,但造成这种错误——
_dynarch_popupCalendar is not defined
[Break On This Error] if (_dynarch_popupCalendar != null) {
我猜测,我可以把<代码>onSelect param添加到新的日历开始之时,从而限制过去的日期。
onSelect: function() {
var date = Calendar.intToDate(this.selection.get());
LEFT_CAL.args.min = date; // setting minimum date, so as to not allow browsing past this date
LEFT_CAL.redraw();
this.hide();
}
But I did not try anything after modifying in the helper script failed.
Please let me know if you have idea about the correct upgrading process. I am not sure what I am missing something.
I had thought it would be as simple as just changing inclusion of the js and may be css files and no change would be needed in code. I would just need to set some more config parameters corresponding to disabling the dates as I desire.
Update
Making it simpler now!!
首先,这并不是一种升级,因为jscal2(我想要使用)的剂量表示:
请注意,这是一个全新的产品。
请注意,这不符合我们原来的日历项目。
I understood that the minimum needed to invoke a calendar is -
Calendar.setup({
cont : "calendar-container" // a cont or a trigger
});
All arguments are optional. However, you should provide one of cont (for inline calendars) or trigger for popup calendars, or else provide your own code to display a popup calendar. We ll see how this can be done later.
我认为,我需要写这部法典,以显示像现在这样一幅人口日历:
function showCalendar(){
...
//some lines of code
...
var cal = new Calendar();
...
//some code to display the calendar, based on the details already being passed to this function - which button was clicked, where to attach the calendar, etc.
...
}
但我在文件中看不到任何这样的守则。 我尝试了这一法典,但并不奏效——
function trigger()
{
cal = new Calendar({
inputField: "startdate",
dateFormat: "%B %d, %Y",
bottomBar: false,
showTime:true
}
});
cal.redraw(); //blind try - does not work, but it does not give any errors. But I
don t see any other proper function to do this in the doc.
}
任何想法?
增 编
Bounty Started
Have found a not-so-good, unoptimized solution, posted it in answer, but still looking for a proper solution.