The resource (row) headers can be customized using BeforeResHeaderRender event handler. This event is called once for every row (even when the rows are generated in Gantt or Timesheet mode).

It is possible to change the HTML, configure active areas, and set custom properties such as CSS class, background color, etc.

JavaScript

The JavaScript version supports two row rendering event handlers.

onBeforeResHeaderRender

  • the original event, it is fired when .resources are transformed into rows
  • it lets you configure row properties (such as eventHeight), but you can't reach real row data (events) here
  • it is fired once for every row during init/update
  • the name should be more a "onRowLoad"
  • API: DayPilot.Scheduler.onBeforeResHeaderRender.

onBeforeRowHeaderRender

  • a special event that is fired in real time whenever the row header is actually rendered
  • can be fired repeatedly as the row headers are rendered progressively (and removed if you scroll them out of the viewport)
  • you can access row event data here

onBeforeResHeaderRender Example

dp.onBeforeResHeaderRender = function(args) {
  if (args.resource.loaded === false) {
    args.resource.html += " (loaded dynamically)";
    args.resource.backColor = "gray";
  }
};

Styling Row Headers using Custom CSS

scheduler-row-header-custom-css-class.png

You can apply custom CSS class to selected rows using onBeforeRowHeaderRender event handler.

CSS

<style>
  .row1 {
      color: white;
      background: red;
  }
</style>

JavaScript

dp.onBeforeRowHeaderRender = function(args) {
  args.row.cssClass = "row1";
};

Adding a Color Bar using Active Areas

scheduler-row-header-active-area-bar.png

Global CSS to make space for the bar (when row header width auto-fit is enabled):

<style>
    .scheduler_default_rowheader_inner
    {
        padding-right: 10px;
    }
</style>

Adding a bar using row header active areas:

dp.onBeforeRowHeaderRender = function(args) {
  var color = (args.row.index % 2) ? "#cc4125" : "#e69138";   // alternating colors
  args.row.areas = [
      { right: 2, top: 2, bottom: 2, width: 6, backColor: color }
  ];
};

ASP.NET WebForms

It's possible to change the following properties:

Background Color Example

protected void DayPilotScheduler1_BeforeResHeaderRender(object sender, DayPilot.Web.Ui.Events.Scheduler.BeforeResHeaderRenderEventArgs e)
{
  if (e.Value == "E")
  {
    e.BackgroundColor = "green";
  }
}

Custom CSS Example

protected void DayPilotScheduler1_BeforeResHeaderRender(object sender, DayPilot.Web.Ui.Events.Scheduler.BeforeResHeaderRenderEventArgs e)
{
  if (e.Value == "E")
  {
    e.CssClass = "my-row";
  }
}

The custom CSS class will be applied to all row header cells (if there are multiple row header columns defined).

ASP.NET MVC

protected override void OnBeforeResHeaderRender(BeforeResHeaderRenderArgs e)
{
  if (Id == "dps_areas")
  {
      e.Areas.Add(new Area().Width(17).Bottom(1).Right(0).Top(0).CssClass("resource_action_menu").Html("<div><div></div></div>").JavaScript("alert(e.Value);"));
  }

  if (e.Columns.Count > 0)
  {
      e.Columns[0].Html = "10 seats";
  }
}