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

How to Create a Rolling Week View?

2 Answers 131 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
andrew
Top achievements
Rank 1
andrew asked on 13 Oct 2013, 08:05 PM
After quickly reviewing the demos and documentation, I assumed that the Week View allowed the day upon which the week starts to be configured (since there are multiple demos with different week start dates.  After doing some testing however I am having some issues making this happen.

I understand from reading some forums that the the way the week view is rendered is a bit more complex that the other views and that the start and end dates are somehow generated from separate logic.  It looks like you can change the start date by using a culture setting, however that only gives the Monday or Sunday selection allowance.

Is there any way to show a rolling week view, or 7-day view, that would always start with today?  It isn't often useful to show dates in the past for users to pick from when scheduling something.  Would it be possible to extend the culture setting to allow for all 7 selections of day of week?

Rosen posted - http://jsbin.com/URESExi/1/edit as an example.... does this multi-day view lose any of the functionality provided by the default WeekView?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 14 Oct 2013, 09:03 AM
Hello Andrew,

Indeed, you will need to use the approach demonstrated in the sample you have referred to, in order to implement such view. For example:

var CustomView = kendo.ui.MultiDayView.extend({   
  options: {   
    selectedDateFormat: "{0:D} - {1:D}"
  },
  name: "customView",
  calculateDateRange: function() {
     //get the next 7 days starting from the selected one
    var start = this.options.date,
        idx, length,
        dates = [];
  
    for (idx = 0, length = 7; idx < length; idx++) {     
      dates.push(start);     
      start = kendo.date.nextDay(start);
    }
     
    this._render(dates);   
  },
   
  nextDate: function() {
    return kendo.date.nextDay(this.startDate());
  }
 
});


The MultidayView class is the base class for both Day and Week views and support the all of their functionality.

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
andrew
Top achievements
Rank 1
answered on 14 Oct 2013, 04:00 PM
Thanks Rosen - We will be modifying the iterator start and length based on the day of the week that the current date is so that we always get our 7 day starting from today.

much appreciate the advice!
Tags
Scheduler
Asked by
andrew
Top achievements
Rank 1
Answers by
Rosen
Telerik team
andrew
Top achievements
Rank 1
Share this question
or