Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Calendar 24 hour labels on week and day views

    This issue has been reported a few months ago in the GWT forum, I'm using smartclient LGPL (SNAPSHOT-2010-11-25) and I need to display the calendar views with 24 hours instead of 12 AM PM.

    Unless I missed something, the labels are defined in the initwidget function of the DaySchedule and WeekSchedule classes, which are listgrids used by the Calendar class.
    In my subclass of the calendar class I added the following code to get 24 hours labels. This solution may help you if you have similar needs... until there is an official way to do it ;-)
    Code:
        initWidget: function(){
    		this.Super("initWidget", arguments);
    		
    // this function will replace the formatcellvalue function defined the DaySchedule
    
    		this.labelColCellValue = function (value, record, rowNum, colNum, grid) {
    			if (rowNum % 2 == 0) {
    				if (rowNum == 0 || rowNum == 48) 
    					return "0:00"
    				else 
    					return (rowNum / 2)+":00";
    			}
    			return "";
    		};
    
    // the first field of these views is the label column.
    		this.dayView.getField(0).formatCellValue = this.labelColCellValue;
    		this.weekView.getField(0).formatCellValue = this.labelColCellValue;
    		
    .....
Working...
X