Is it possible to configure the view to display M-F instead of all week?
Hello,
check “Custom View” example from Scheduler.MVC3 project
I found that tutorial and was able to make the following changes to allow the button to appear in the view. But I am unable to figure out how to trigger the new button itself to refresh the contents of the view.
In the MVC it looks like its using ActionResult which doesn’t exist in my regular VB project.
Also this command which looks to reconfigure the view don’t appear to be available under the VB DHXScheduler().
scheduler.date.workweek_start = scheduler.date.week_start;
'Added to the default.aspx.vb
Public Class WorkWeekView
Inherits SchedulerView
Public Sub New()
MyBase.New()
Name = InlineAssignHelper(ViewType, "workweek")
End Sub
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function
End Class
'Under the Page_Load
Scheduler.Views.Add(New WorkWeekView() With {.Label = “W-Week”})
Okay, I figured it out. I added the MVC javascript to the dhtmlxscheduler.js and made a few changes. Then it loads up and changes the view properly.
window.scheduler.attachEvent(“onTemplatesReady”, function () {
//work week
scheduler.date.workweek_start = scheduler.date.week_start;
scheduler.templates.workweek_date = scheduler.templates.week_date;
scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date;
scheduler.date.add_workweek = function (date, inc) { return scheduler.date.add(date, inc * 7, “day”); }
scheduler.date.get_workweek_end = function (date) { return scheduler.date.add(date, 5, “day”); }
});
Is there an option to set the new view as the Default View when the page starts up?
Hello,
modifying of the source files is highly not recomended, it will cause problems with future updates.
It’s better to put this code in separate file and attach it after .GenerateLinks() call[code]<%= Model.GenerateLinks() %>
<%= Model.GenerateHTML() %>[/code]Where custom_script.js will contain related js code
scheduler.attachEvent("onTemplatesReady", function () {
//work week
scheduler.date.workweek_start = scheduler.date.week_start;
scheduler.templates.workweek_date = scheduler.templates.week_
....
As for setting workweek as a default view, you should assign view name to DHXScheduler.InitialView
Scheduler.InitialView = "workweek";
Name of the view was specified in class definition, check WorkWeekView constructor
I am not using an MVC but an ASP.NET web app project. I do not have the <%= Model.GenerateLinks() %> so it doesn’t work.
Instead I tried the following
<%= me.Scheduler.Render()%>
Then you could try[code]<%= me.Scheduler.GenerateLinks() %>
<%= me.Scheduler.GenerateHTML() %>[/code]
In this case the only difference between MVC and WebForms application is the way the page refers DHXScheduler instance. MVC page already has property for parameter object (me.Model) while in WebForms we define a custom one (me.Scheduler), it does not requires changes any other logic