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

Set Scheduler width with javascript in View

Asked by Jeffrey
10 years ago.

Hello,

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() {
dp.commandCallBack("prevmth");
SetWidth();

}

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

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

Cheers,

J.

Answer posted by Dan Letecky [DayPilot]
10 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):

https://doc.daypilot.org/scheduler/auto-cell-width/

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

https://doc.daypilot.org/scheduler/width/

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
10 years ago.

Thanks,

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

@Html.DayPilotScheduler("dp", new DayPilotSchedulerConfig
{

...

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

Cheers...

Comment posted by Dan Letecky [DayPilot]
10 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.