Working on customizing Calendar, removing date from calendar weekview headers and EventDialogTitle.
here is my solution i have modified Calendar.js
and for removing date from EventDialogTitle
one more thing for setting showDateInWeekView/showDateInEventDialogTitle from java code.
here is my solution i have modified Calendar.js
Code:
showDateInWeekView: true, _setWeekTitles : function () { if (!this.weekView) return; var nDate = this.chosenWeekStart.duplicate(); // set day titles var sdNames = Date.getShortDayNames(); var weekends = Date.getWeekendDays(); for (var i = 1; i < 8; i++) { // for hidden columns, getFieldNum will return -1. without this check, a logWarn is // produced when weekends are hidden if (this.weekView.getFieldNum("day" + i) >= 0) { var ntitle; if(this.showDateInWeekView){ ntitle = sdNames[nDate.getDay()] + " " + (nDate.getMonth() + 1) + "/" + nDate.getDate(); } else { ntitle = sdNames[nDate.getDay()]; } // _dayNum is used in colDisabled() // _dateNum, monthNum, yearNum are used in headerClick var fieldProps = { title: ntitle, align: "right", _dayNum: nDate.getDay(), _dateNum: nDate.getDate(), _monthNum: nDate.getMonth(), _yearNum: nDate.getFullYear() } this.weekView.setFieldProperties("day" + i, fieldProps); if (this.weekView.header) this.weekView.header.markForRedraw(); //isc.logWarn('here:' + [nDate.toShortDate(), "day" + i]); } nDate.setDate(nDate.getDate() + 1); } },
and for removing date from EventDialogTitle
Code:
showDateInEventDialogTitle: true, _getEventDialogTitle : function (startDate, endDate) { // var dayNames = ["Sunday","Monday","Tuesday","Wednessday","Thursday","Friday","Saturday"]; var dayNames = Date.getShortDayNames(); var monthNames = Date.getShortMonthNames(); var sHrs = startDate.getHours(), eHrs = endDate.getHours(), sMins = startDate.getMinutes(), eMins = endDate.getMinutes(), sStr, eStr; sStr = this._to12HrNotation(sHrs) + (sMins < 10 ? ":0" + sMins : ":" + sMins); eStr = this._to12HrNotation(eHrs) + (eMins < 10 ? ":0" + eMins : ":" + eMins) + (eHrs > 11 ? "pm" : "am"); if (!((sHrs < 12 && eHrs < 12) || (sHrs > 11 && eHrs > 11))) sStr += (sHrs > 11 ? "pm" : "am"); var timeStr = sStr + " - " + eStr; if(this.showDateInEventDialogTitle){ return dayNames[startDate.getDay()] + ", " + monthNames[startDate.getMonth()] + " " + startDate.getDate() + ", " + timeStr ; } else{ return dayNames[startDate.getDay()] + ", " + timeStr ; } },
Code:
public void setShowDateInWeekView(boolean value){ JavaScriptObject config = calendar.getConfig(); JSOHelper.setAttribute(config, "showDateInWeekView", value); }