This is a migrated thread and some comments may be shown as answers.

Display S M T W T F S in scheduler

4 Answers 43 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 09 Jul 2008, 11:29 AM
I would like to display the week view column headers as "S M T W T F S" (rather than "Sun Mon Tue Wed Thu Fri Sat" ) in the RadScheduler but I can't find a way to do it.

As far as I know there is no custom date format string I can use (a single 'd' returns the full date, whereas 'ddd' returns Mon, Tue, Wed... etc)

I've found the DateTimeInfo.AbbreviatedDayNames property which seems to control this list of strings, but I can't see a way to persuade the RadScheduler to use my own AbbreviatedDayNames.

Can anyone help?

4 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 09 Jul 2008, 12:28 PM
Hello Mark,

We do not support header templates just yet, but we can workaround the problem with some JavaScript:

function pageLoad() 
    var columnHeaderRow = $telerik.getElementByClassName(document.body, "rsColumnHeaderRow""tr"); 
    if (!columnHeaderRow) return
    for (var i = 0; i < columnHeaderRow.cells.length; i++) 
    { 
        var headerText = columnHeaderRow.cells[i].innerHTML
        headerText = headerText.replace(/Mon/, "M"); 
        headerText = headerText.replace(/Tue/, "T"); 
        headerText = headerText.replace(/Wed/, "W"); 
        headerText = headerText.replace(/Thu/, "T"); 
        headerText = headerText.replace(/Fri/, "F"); 
        headerText = headerText.replace(/Sat/, "S"); 
        headerText = headerText.replace(/Sun/, "S"); 
         
        columnHeaderRow.cells[i].innerHTML = headerText; 
    } 
 


Regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 09 Jul 2008, 12:59 PM
Thanks for your help - however I am using the GroupBy property so there are multiple rsColumnHeaderRow elements. Is there a way to iterate through all of them in order to find the correct one ?
0
Accepted
T. Tsonev
Telerik team
answered on 09 Jul 2008, 02:33 PM
Hi Mark,

Sure thing:

function getAllElementsByClassName(className, tagName) 
{   
    var children = document.body.getElementsByTagName(tagName ? tagName : "*"); 
    var elements = []; 
    var child; 
     
    var length = children.length; 
    for (var i = 0; i < length; i++) 
    { 
        child = children[i]; 
       
        if (Sys.UI.DomElement.containsCssClass(child, className)) 
        { 
            elements.push(child); 
        } 
    } 
     
    return elements;   
 
function pageLoad() 
    var columnHeaderRows = getAllElementsByClassName("rsColumnHeaderRow""tr"); 
     
    for (var headerIndex = 0; headerIndex < columnHeaderRows.length; headerIndex++) 
    { 
        var row = columnHeaderRows[headerIndex]; 
        for (var i = 0; i < row.cells.length; i++) 
        { 
            var headerText = row.cells[i].innerHTML
            headerText = headerText.replace(/Mon/, "M"); 
            headerText = headerText.replace(/Tue/, "T"); 
            headerText = headerText.replace(/Wed/, "W"); 
            headerText = headerText.replace(/Thu/, "T"); 
            headerText = headerText.replace(/Fri/, "F"); 
            headerText = headerText.replace(/Sat/, "S"); 
            headerText = headerText.replace(/Sun/, "S"); 
             
            row.cells[i].innerHTML = headerText; 
        } 
    } 
 


Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 09 Jul 2008, 03:43 PM
Cheers - that did the trick.
For info I squashed the code down to the following -

function fixHeaders()

    var children = document.body.getElementsByTagName("tr" ? "tr" : "*"); 
    var child; 
    var length = children.length; 
    for (var i = 0; i < length; i++) 
   { 
        child = children[i]; 
        
if (Sys.UI.DomElement.containsCssClass(child, "rsColumnHeaderRow")) 
        { 
            
for (var j = 0; j < child.cells.length; j++) 
            { 
                
var headerText = child.cells[j].innerHTML; 
                headerText = headerText.replace(/Mon/,
"M"); 
                headerText = headerText.replace(/Tue/,
"T"); 
                headerText = headerText.replace(/Wed/,
"W"); 
                headerText = headerText.replace(/Thu/,
"T"); 
                headerText = headerText.replace(/Fri/,
"F"); 
                headerText = headerText.replace(/Sat/,
"S"); 
                headerText = headerText.replace(/Sun/,
"S"); 
                child.cells[j].innerHTML = headerText; 
            } 
        } 
    }
}

Tags
Scheduler
Asked by
Mark
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Mark
Top achievements
Rank 1
Share this question
or