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

Creating a custom view with templates not listed in the docs

2 Answers 19 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 25 Jun 2015, 12:08 AM

I'm trying to create a custom column with the scheduler, but I always get redirected to a sample mvc program that just modifies the events template

 I need to actually make a new column, not change the color of it.

 The only templates I see listed in the docs are event templates.  I need the schedule header.  I want to display

<td>Monday</td><td>MyColumn1</td><td>MyColumn2</td><td>Tuesday</td>....

 The dataHeaderTemplate only lets me change whats inside of Monday.

 So my questions are, where are the lists of these templates and how do I get the default values so I can change them and create a new custom view.

This is the closest thing I've seen:

http://dojo.telerik.com/@diondirza/EbEBa

they're doing the following below.  But how I get the default value for schedulerHeader and add change it for my customer view.

function onDataBound(e) {
  var scheduler = e.sender,
      schedulerHeader = scheduler.element.find(".k-scheduler-header table tbody tr"),
      datas = scheduler.dataSource.data();
   
  // add custom column header, do more append for more column
  schedulerHeader.append("<th>Rating</th>");
  schedulerHeader.append("<th>Time</th>");
   
  // add custom column for each data
  datas.forEach(function(data){
    var uid = data.uid,
        timeData = kendo.toString(data.start, "hh:mm") + " - " + kendo.toString(data.end, "hh:mm");
     
    $(".k-task[data-uid='"+ uid +"']").parent()
        .after("<td>" + timeData + "</td>")
        .after("<td><em>no rating yet</em></td>");
  });
}

 

2 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 25 Jun 2015, 05:21 PM

Some one was able to create a dojo that is in the direction on how i would like to make a custom view:

http://dojo.telerik.com/@diondirza/EbEBa/4

 

Is this an okay way to do things? Will it break any of the scheduler features like drag and drop? Will this also work for future builds of the scheduler?

0
Georgi Krustev
Telerik team
answered on 26 Jun 2015, 02:16 PM
Hello George,

In general, the best way would be to create a custom view. In this case, you will get full control over rendering and will be able to implement your custom logic. I posted a demo, which shows how to extend views in the other forum thread opened on the same subject:
With regards to the shared Dojo demo, it modifies the rendered view on every dataBound, which will be raised many times (for instance on page resize). Also this approach breaks the view layout, because the inserted elements are not calculated within the view itself. I would also consider that the event resizing will not work as expected too.

I would suggest you create a custom view instead of modifying the already rendered view. It is safer and you will be of a full control over the functionality you are pursuing. 

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Tony
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or