not selecetable EventDates
Hello,
I've managed my issue with the deactivating the EventDates, just in case anyone needs it too:
first define the config variable
Code:
/**
* @cfg {Boolean} eventDatesSelectable
* Whether the Event should be selectable or not
*/
eventDatesSelectable : true,
add the "eventDatesSelectable: true" to the rest of config vars where you define your DatePickerPlus
add new event disabled css classes (similar to disable class but different background color)
Code:
.x-date-inner .x-datepickerplus-eventdates-disabled a:hover {
background: #EB5F01;
color: #fff;
... /* more css code */
}
.x-date-inner .x-datepickerplus-eventdates-disabled a {
background: #EB5F01;
color: #ffffff;
cursor:default;
... /* more css code */
}
change this part and add the if/else to the ext.ux.datepickerplus.js
Code:
//mark dates with specific css (still selectable) (higher priority than weekends)
if (cal.eventDatesNumbered[0].length>0) {
foundday = cal.eventDatesNumbered[0].indexOf(t);
if (foundday!=-1) {
if(cal.eventDatesNumbered[1][foundday]!==""){
if(cal.eventDatesSelectable) {
var eventClass = cal.eventDatesNumbered[2][foundday];
} else {
var eventClass = cal.eventDatesNumbered[2][foundday] + '-disabled';
}
eCell.addClass(eventClass);
tiptext = (cal.eventDatesNumbered[1][foundday]!=="" ? cal.eventDatesNumbered[1][foundday] : false);
}
}
}
and finaly add the following to ext.ux.datepickerplus.js to the date click handler
Code:
if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled") && !Ext.fly(t.parentNode).hasClass("x-datepickerplus-eventdates-disabled") ){
maybe there are better solutions - but it works :)
no I have to look to the next issue: allow only selecting and scrolling trough the allowed months and disable the prev/next month/year buttons for months before minDate and also for months later than maxDate. :-?
year and month listeners question
Hi:
Your extension is exactly what I need for a project. Thanks for your work!!
I am running into some troubles when using the following listeners:
PHP Code:
"beforeyearchange"
"afteryearchange"
"beforemonthchange"
"aftermonthchange"
Basically, the event is executed. However, the event get fired again and again, rather than just once.
For example: when I define the following listener:
PHP Code:
listeners:{'afteryearchange':function(){ alert('changed year'); }}
I would get a popup over and over again, and the year changes more than once too.
I tried with Firefox on Windows and linux, as well as IE6, and I get the same behavior with all of those.
Thanks in advance for your help :) My goal is to update/change the allowedDates array with the result from an Ajax call, when a month or a year gets changed.
Forcing the user to select only weeks
Dear wm003,
I thought I would post this as it maybe helpful, I have added to the afterdateclick event as you advised.
It works, see what you think.
PHP Code:
listeners: {
afterdateclick: function(dp, date){
var startdate = new Date(dp.lastSelectedDate);//use this to check whats been clicked
var firstday = new Date(date).getFirstDateOfWeek(dp.startDay);//get the first day of week date
var lsdCell = dp.lastSelectedDateCell.split("#");//needed for the daycell value
var tmpMonthCell = parseInt(lsdCell[0],10);
var tmpDayCell = parseInt(lsdCell[1],10);
if(tmpDayCell < 7){//set the start cell to select
var s = 0;
}else if(tmpDayCell > 6 && tmpDayCell < 14){
var s = 7;
}else if(tmpDayCell > 13 && tmpDayCell < 21){
var s = 14;
}else if(tmpDayCell > 20 && tmpDayCell < 28){
var s = 21;
}else{
var s = 28;
}
for (var i = 0; i < 7; i++) {//loop through and select them all
var nextday = firstday.clearTime().add(Date.DAY, i);
if(nextday.getElapsed(startdate) !== 0){//check for sameday value
dp.markDateAsSelected(nextday,true,0,s+i,true);
}
}
}
}
Thanks for the pointer before
George