search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Set Scheduler width with javascript in View

Asked by Jeffrey
7 years ago.


In order to remove the blank space on the right of Scheduler for months with 28, 29 or 30 days I have done this:

function prevmth() {


function SetWidth() {
var sdays = dp.startDate.daysInMonth();
switch (sdays) {
case 28:
dp.SetWidth = 1337;
case 29:
dp.SetWidth = 1377;
case 30:
dp.SetWidth = 1417;
case 31:
dp.SetWidth = 1457;

But the width does not change accordingly, any heads up?



Answer posted by Dan Letecky [DayPilot]
7 years ago.

You might want to check the "Auto Cell Width" feature which adjusts the cell width to fill the available space (there will be no horizontal scrollbar):

The total width of the control can be set using "width" property which uses CSS syntax:

I did a quick test and it doesn't work with .update() at the moment - only with .init() during the initialization.

Comment posted by Jeffrey
7 years ago.


the = "Auto" could not be set in the View but this worked:

@Html.DayPilotScheduler("dp", new DayPilotSchedulerConfig


Theme = "scheduler_8",
Width = "Auto",
CellWidthSpec = 0,


Comment posted by Dan Letecky [DayPilot]
7 years ago.

Thanks for the update. The CellWidthSpec accepts DayPilot.Web.Mvc.Enums.Scheduler.CellWidthSpec enum so you may need to specify it like this:

@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig {
    CellWidthSpec = DayPilot.Web.Mvc.Enums.Scheduler.CellWidthSpec.Auto,
    // ...

Using CellWidthSpec = 0 may work because 0 is converted to CellWidthSpec.Auto but it's not future-proof.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.