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

Hide weekend functionality?

4 Answers 76 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 12 Jul 2012, 06:22 PM
Hi All,

Is there any Hide Weekend type functionality available on the scheduler yet? 

Regards,

Jon

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 13 Jul 2012, 06:30 AM
Hi Jon,

I suppose you want to hide the LastDayOfWeek in the RadScheduler when the SelectedView is WeekView. Following is the sample code.

CSS:
<style type="text/css">
  .rsDisabled
   {
     width: 0px;
   }
</style>

C#:
protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
  {
    if ( e.TimeSlot.Start.DayOfWeek == RadScheduler1.LastDayOfWeek && RadScheduler1.SelectedView == SchedulerViewType.WeekView)
      e.TimeSlot.CssClass = "rsDisabled";
  }

JS:
<script type="text/javascript">
    var specialDaysIndexes = new Array();
    function pageLoad() {
        debugger;
        if ($find('<%=RadScheduler1.ClientID %>').get_selectedView() == Telerik.Web.UI.SchedulerViewType.WeekView) {
            var $ = $telerik.$;
            $('.rsDisabled').each(function (i) {
                specialDaysIndexes.push($(this).index());
            });
            for (x in specialDaysIndexes) {
                $($(".rsHorizontalHeaderTable th", $find('<%=RadScheduler1.ClientID %>').get_element()).get(specialDaysIndexes[x])).css("width", "0px")
            }
            specialDaysIndexes = [];
        }
    }
</script>

Hope this helps.

Regards,
Princy.
0
Jon
Top achievements
Rank 1
answered on 13 Jul 2012, 08:52 AM
Hi Princy

Many thanks for that.  Yes Saturday and Sunday need to be hidden.

The code seems to all run fine and in the main part the days get hidden nicely however the header doesn't have the saturday and sunday hidden, the jquery doesn't seem to function properly - it does run and looking at the specialdaysindexes I can see the it has 0 and 6 repeated many times so obviously it's trying to do something.  My jquery ability is 0 at the moment so debugging it is somewhat tricky though :(

Is there another way to hide the header days?

Best Regards,

Jon
0
Peter
Telerik team
answered on 17 Jul 2012, 02:00 PM
Hi Jon,

In general, this is not supported functionality and workarounds you use will have limitations. That said, you can try the following modification, but I advise you to fully test it and make sure it does not fail for some scenarios that you will use:
<head id="Head1" runat="server">
  
    <script type="text/javascript" src="jquery.js"></script>
  
    <style type="text/css">
  
          
  
        /*Comment this style*/
  
        /*.rsDisabled
  
        {
  
            width: 0px;
  
        }*/
  
    </style>
  
</head>
  
<body>
  
    <telerik:radcodeblock id="RadCodeBlock1" runat="server">
  
        <script type="text/javascript">
  
  
  
            var specialDaysIndexes = new Array();
  
            var aux = 1;
  
            var appoinmentCellWasResized = false;
  
            var planboardID = '<%=RadScheduler1.ClientID %>';
  
  
  
            function pageLoad() {
  
                var $ = $telerik.$;
  
                var scheduler = $find('<%=RadScheduler1.ClientID %>');
  
                if ($find('<%=RadScheduler1.ClientID %>').get_selectedView() == 4) {
  
  
  
                    var tds = $('table.rsAllDayTable tr.rsAllDayRow .rsDisabled');
  
                    var ths = $(".rsHorizontalHeaderTable th ");
  
  
  
                    tds.each(function (i) {
  
                        specialDaysIndexes.push($(this).index());
  
                    });
  
                      
  
  
  
                    for (x in specialDaysIndexes) {
  
                        //$(ths.get(specialDaysIndexes[x])).css("width", "0px");
  
                        $(ths.get(specialDaysIndexes[x])).remove();
  
                    }
  
                    tds.remove();
  
  
  
                    scheduler.repaint();
  
                    specialDaysIndexes = [];
  
                    if (!appoinmentCellWasResized) {
  
                        $('.rsApt').each(function () {
  
                            $(this).css("width", $(this).width() - 10);
  
                        });
  
                        appoinmentCellWasResized = true;
  
                    }
  
                }
  
            }
  
  
  
        </script>
  
</telerik:radcodeblock>


All the best,
Peter
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
Jon
Top achievements
Rank 1
answered on 23 Jul 2012, 08:18 AM
Hi Peter,

Many thanks for that.  I've given a quick go and it didn't seem to work so I'll have a look after my holiday - don't want to introduce a new issue before then :)

Thanks for our help.

Regards,

Jon
Tags
Scheduler
Asked by
Jon
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Peter
Telerik team
Share this question
or