Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Get date from day header in WebWeekView
posted

Hello,

Is there any way to get the date value shown in the header of each day of WebWeekView control in a Double Click Event?

I can´t find the Function

Thank You

 

Parents
No Data
Reply
  • 4960
    Suggested Answer
    posted

    sniper_lcd said:

    Is there any way to get the date value shown in the header of each day of WebWeekView control in a Double Click Event?

    If you really need the exact text that is shown in the day header of the WebWeekView and which may be localized for the user, then you can get it from the innerText of the TD element having the "uie" attribute value of "DayHeader".  This will be the element argument passed-in to your event handler when the user double-clicks on the DayHeader (this is the easier of the two possibilities).  However, the other possibility is that the user double-clicks on the Day instead, and then you'd need to walk-up the DOM node tree to your immediate TR ancestor, and then walk back through any previousSibling nodes to the first TR childNode, and then walk down to the TD element having the "uie" attribute value of "DayHeader".  (in IE this can be as simple as bink, bank, boop; although in FF it may mean stepping over whitespace nodes).

    If all you need is the date then that is much easier, because both the DayHeader TD and the Day TD will have a "date" attribute on them, so you can just grab and parse that into a Date string.

    function WebWeekView1_DblClick( oWeekView, oEvent, element)
    {
        var attr = element.getAttribute("date");
        if ( attr != null )  {
            var dateParts = attr.split(",");
            if ( dateParts != null )  {
                var thisDate = new Date();
                var yyyy = parseInt( dateParts[ 0]);
                var mm = parseInt( dateParts[ 1]);
                var dd = parseInt( dateParts[ 2]);
                thisDate.setFullYear( yyyy, mm, dd);
                alert( thisDate.toDateString());
            }
        }
    }

Children
No Data