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

Parent Row

Asked by Steve Lee
1 year ago.

Hi.

I'm missing something obvious. I want to apply a background color to the parent rows.

I have this preventing clicking on the parent rows

treePreventParentUsage: true,

And this to grey out the latter part of Fridays:

dp.onBeforeCellRender = function (args) {
    if (args.cell.start.getDayOfWeek() === 5 && args.cell.start.getHours() > 11|| args.cell.resource === "D") {
        args.cell.backColor = "#ccc";
    }
};

But I' cannot work out how to apply "#ccc" to the background of parent rows!

Can you help?

Thank you.

Comment posted by Dan Letecky [DayPilot]
1 year ago.

This should work fine. I recommend using the browser developer tools to inspect the parent cell elements. You will be able to see why the background color doesn't apply.

The problem might be something like a global CSS that overrides the background color for parent cells using "!important".

Comment posted by Steve Lee
1 year ago.

Hi Dan

Apologies.. I listed the code I'm using, successfully, to grey out Friday afternoons.

What I'm trying to, and failing, to do is grey out the parent rows. The same rows that are targeted with
treePreventParentUsage: true,

Sorry for the confusion.

Answer posted by Dan Letecky [DayPilot]
1 year ago.

Steve,

Sorry for the confusion!

You can detect parent rows using `args.cell.isParent`:

dp.onBeforeCellRender = function (args) {
    if (args.cell.isParent) {
        args.cell.backColor = "#ccc";
    }
};

It looks like it was missing in the documentation. It's updated now:
https://api.daypilot.org/daypilot-scheduler-onbeforecellrender/

Comment posted by Steve Lee
1 year ago.

Hi Dan

Thank you :-) Much appreciated.

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