How do i get the column header selected state in a radcalendar?

2 posts, 0 answers
  1. Vithiya
    Vithiya avatar
    41 posts
    Member since:
    May 2008

    Posted 24 Feb 2010 Link to this post

    I have a radcalendar that has EnableMultiSelect="true" and UseColumnHeadersAsSelectors="true". When a user clicks on the column header, I need to know if the click is going to select or deselect the dates. OnDateClick event has a get_isSelected() method I can use to determine if the clicked date is selected or not selected. Similarly, I want to know if the column header click is to select or deselect the respective dates.

    Thank you,
    Vithiya
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 26 Feb 2010 Link to this post

    Hello Vithiya,

    When the RadCalendar.UseColumnHeadersAsSelectors property is set to true and user clicks on the header all dates under the header are selected, not the header item. So the header item does not keep any state for selection.

    To achieve the desired functionality you could try the following approach:
    When the user clicks on the header's item you could handle the OnDateSelected event and set a boolean flag to the value returned from eventArgs.get_renderDay().get_isSelected() method. In that way you could know if the dates under the header item is selected or deselected:

    <script type="text/javascript">
     var isHeaderSelectDates = false;
     function onDateSelected(sender, eventArgs) {
          isHeaderSelectDates= eventArgs.get_renderDay().get_isSelected();
     }
     
     function onColumnHeaderClick(sender, eventArgs) {
       setTimeout(function() {
          if (isHeaderSelectDates) {
              alert("Selecting dates");
          }
          else {
              alert("Deselecting dates");
          }
       }, 30);
    }
    </script>

    Also I attached a small runnable application which demonstrates how to achieve the desired scenario.

    I hope this helps.

    Greetings,
    Radoslav
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top