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

Hide all Time Headers in Scheduler

Asked by Patrick Burrows
11 years ago.

Is there a way to hide all time headers in scheduler?

I have a display where I am using multiple instances of the control, and I want only the top instance to display headers.

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

You can use the following workaround:

function afterRender(data, isCallBack) {
    dps1.showBaseTimeHeader = false;
    dps1.timeHeaders = [];
    dps1.update();
}
And set AfterRenderJavaScript="afterRender(data, isCallBack)"
Comment posted by Patrick Burrows
11 years ago.

Awesome. I wasn't able to get the AfterRenderJavaScript event to fire. I even tried:
AfterRenderJavaScript="alert('after render');",

But the technique works great just called from jQuery's "ready" event.

Comment posted by Patrick Burrows
11 years ago.

Hm. Sadly, this technique causes an issue when editing. The code complains that there are no headers.

The error seems to be in setting the CellGroupBy, so I removed any references to CellGroupBy property in my code hoping that might fix it, but it does not. The error is in initializing the DayPilotScheduler object.

Here is the error details:

TimeHeaders collection does not contain any header group definition.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: TimeHeaders collection does not contain any header group definition.

Source Error:

Line 72: public ActionResult Backend(int id)
Line 73: {
Line 74: return new BackendDayPilotScheduler(id).CallBack(this);
Line 75: }
Line 76:

Stack Trace:

[Exception: TimeHeaders collection does not contain any header group definition.]
DayPilot.Web.Mvc.DayPilotScheduler.set_CellGroupBy(GroupBy value) +166
DayPilot.Web.Mvc.DayPilotScheduler.CallBack(Controller c) +1470
Davita.Maestro.UI.Prototype.DayPilot.Controllers.ScheduleController.BackendEmployee(Int32 id) in d:\docs\Dropbox\Dropbox\Dev\Wintellect\Davita\Maestro\src\Davita.Maestro.UI.Prototype.DayPilot\Controllers\ScheduleController.cs:74
lambda_method(Closure , ControllerBase , Object[] ) +97
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +182
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +225
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

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

I will check if there is any workaround for this issue.

By the way, is it really necessary to use two schedulers and get rid of the header? Wouldn't it be possible to use a single scheduler, possibly with a separating row in the middle?

Comment posted by Patrick Burrows
11 years ago.

I will try to create the interface using a single grid. I think it will be harder to manage that way, and potentially harder to style. We shall see.

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

If there is anything that could be added to DayPilot to make this easier for you, let me know.

In my experience, whenever someone wants to hide the header it indicates a workaround/missing feature.

I don't promise that there will be a good solution but sometimes it can be done.

Comment posted by Patrick Burrows
11 years ago.

I'm not getting the look / effect I want from the single instance. I am trying to create a screen that looks like this (mocked up quickly in Excel)
https://dl.dropboxusercontent.com/u/10121209/DayPilotExcelSample.png

I was able to create that exactly with the multiple instance. Essentially, I use tables, and the "Always", "Group 1", and "Group 2" fields are one column, and the scheduler is the other column for each table.

I can create a treeview which mimics the effect I want using a single instance, but the tree look doesn't have anywhere near the same layout. I would have to be able to, somehow, merge cells vertically. And I don't think you could easily add that functionality.

Also, the rows with names are a different scheduling entity than the rows that start with "Res ." Having those as one instance makes my backend code slightly more complicated (though that is not a big deal to me.)

Answer posted by Patrick Burrows
11 years ago.

I modified the source so that the DayPilotScheduler.CellGroupBy parameter returns a GroupBy.None on get if TimeHeaders is null or empty. And on set, it just returns if Timeheaders is null or empty. (see source below)

In limited testing, I found no side-effects from doing this, other than the obvious (if you have no timeheaders, you will have no grouping, which is fine for my use case).

[Obsolete("Please use TimeHeaders collection instead.")]
public GroupBy CellGroupBy
{
get
{
if (TimeHeaders == null)
{
return GroupBy.None;
//throw new Exception("TimeHeaders collection is null.");
}
if (TimeHeaders.Count == 0)
{
return GroupBy.None;
//throw new Exception("TimeHeaders collection does not contain any header group definition.");
}
return TimeHeaders[0].GroupBy;
}
set
{
if (TimeHeaders == null)
{
return;
//throw new Exception("TimeHeaders collection is null.");
}
if (TimeHeaders.Count == 0)
{
return;
//throw new Exception("TimeHeaders collection does not contain any header group definition.");
}
TimeHeaders[0].GroupBy = value;
}
}

Comment posted by Guy Lister
10 years ago.

Patrick,

Did you get your multiple instance UI to work as shown in your png?

Comment posted by Patrick Burrows
10 years ago.

Yes, and it is working just fine. No issues.

For performance reasons, though, I wound up doing everything 100% in JavaScript and not using any of the native Ajax functionality that you get when you set a BackendUrl. So I have my own Ajax calls (using jQuery) to handle the onEventClick, onEventMove, and onEventResize events.

Again, I am doing the above primarily for performance reasons. I can't remember if I also had to do it because of an issue with having no headers. But I am pretty sure I did not and that there was no issues with using the BackendUrl functionality with no headers once you modified the source code as I described above. But it has been awhile and I cannot remember exactly.

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