Tooltip calendar - RTL issue

2 posts, 0 answers
  1. jc mag
    jc mag avatar
    106 posts
    Member since:
    Aug 2005

    Posted 07 Jun 2011 Link to this post

    I want to display the hijri conversion of dates in a RadCalendar ; the problem is that the text is left-to-right and I need to change it to RTL...
    (see picture attached, the tooltip should display "الإثنين 02 رمضان 1432")
  2. Fortune
    Fortune avatar
    5 posts
    Member since:
    Jun 2011

    Posted 08 Jun 2011 Link to this post

    Hi, jc mag

    You could iterate over all calendar’s cells and reverse the text from theirs title attribute. For example: 
    <telerik:RadCodeBlock runat="server">
            <script type="text/javascript">
                function ChangeTitles(sender,eventArgs)
                {
                    if(sender.CurrentViews.length>0)
                    {
                        var allCells = getAllCells(sender.CurrentViews[0].DomTable);
                        if(allCells)
                        {
                            for(var i=9;i<allCells.length;i++)
                            {
                                var title=allCells[i].title;
                                if(title && (title != " " || title != ""))
                                {
                                    allCells[i].title = reverseTitle(title);
                                }
                            }
                        }
                    }
                }
     
                function getAllCells(table)
                {
                    if(table.cells)
                    {
                        return table.cells;
                    }
                    else
                    {
                        var cells = new Array();
                        for (var i = 0; i < table.rows.length; i++)
                        {
                            var row = table.rows[i];
                            for (var j = 0; j < row.cells.length; j++)
                            {
                                cells.push(row.cells[j]);
                            }
                        }
     
                        return cells;
                    }
                }
     
                function reverseTitle(title)
                {
                    var splitetedArray=title.split(" ");
                    var newTtitle="";
                    for(var i=splitetedArray.length - 1;i>=0;i--)
                    {
                        newTtitle=newTtitle+splitetedArray[i]+" ";
                    }
     
                    return newTtitle;
                }
     
            </script>
        </telerik:RadCodeBlock>
        <telerik:RadCalendar runat="server">
            <ClientEvents OnLoad="ChangeTitles" OnCalendarViewChanged="ChangeTitles" />
        </telerik:RadCalendar>

    Best,
    F
Back to Top