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

How do I add a Date Suffix to the ColumnHeaderDateFormat in a RadScheduler Timeline view?

6 Answers 102 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 12 Mar 2013, 04:04 PM
I know how to format the column headers in a RadScheduler's TimeLineView so I can display the date in any format I choose, but cannot see how I would add the date suffix.

For example I want to show the short version of the days name, followed by the date of the month.
For today (Tuesday, 12th of March 2013) I want to display "Tue 12th" but all I can get is "Tue 12".

Personally, it makes no odds to me and I prefer just the "Tue 12" for a number of reasons, but the powers that be want the date suffix!

Anyone have any ideas?
Thanks,
Karl

6 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 15 Mar 2013, 10:50 AM
Hello Karl,

Since such date time formatting does not comes out of the box, I have prepared a custom client-side functionality that implements very similar scenario only for your RadScheduler Timeline View.
//markup code
<telerik:RadScheduler runat="server" ID="RadScheduler1" >
 </telerik:RadScheduler>
//JavaScript
function pageLoad() {
    $ = $telerik.$;
    var scheduler = $find('<%=RadScheduler1.ClientID %>');
    if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView) {
        var headerColumns = $(".rsHorizontalHeaderTable th div");
        headerColumns.each(function (index, elem) {
            var date = $.trim($(elem).text());
            var indexOfSpace = date.indexOf(" ");
            var monthDay = date.substring(indexOfSpace + 1, date.lenght);
            if (monthDay == 1) {
                date += "st";
            }
            else if (monthDay == 2) {
                date += "nd";
            }
            else {
                date += "th";
            }
            $(elem).text(date);
        });
    }
     
}



Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
shubhangi
Top achievements
Rank 1
answered on 14 Sep 2015, 10:50 AM

Where we can call this Function Page_load()

Thanks,

Shubh

0
shubhangi
Top achievements
Rank 1
answered on 14 Sep 2015, 11:00 AM

Hi,

I have added function below for showing jobstatus in different color as per requirement. for that i have added some html code and showing as i want. 

  function page_load() {
            var $ = $telerik.$;
            var $header = $(".rsHeader h2");
            var result = '';
            result += '<Span class ="tab">' + "<u>Job Status:</u> " + '<Span class ="clr1"> ' + "Success" + '</span>' + '<Span class ="clr2">' + " Runing " + '</span>' + '<Span class ="clr3">' + " Failed " + '<span>' + '<Span class ="clr4">' + " Deleted " + '</span>' + '</span>';
            $header.html($header.html() + result)
        }

Code Behind:

   protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "page_load()", true);

        }

 But after inserting record the label are not visible means page is not loading again. Please give me any idea where we can call this function Page_Load(). You can see implemented changes in attachment image.

 

Thanks,

shubh

0
Plamen
Telerik team
answered on 17 Sep 2015, 06:48 AM
Hello,

You can sue the  pageLoad() without the need to register it from the code behind.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
shubhangi
Top achievements
Rank 1
answered on 24 Nov 2015, 10:31 AM

Hi..

I tried its not working after adding or updating schedule or after clicking on radscheduler calendar. Please help me in to this..

0
Plamen
Telerik team
answered on 26 Nov 2015, 08:44 AM
Hi,

I am attaching the code that worked correctly at my side.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
Karl
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
shubhangi
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or