You can apply the CSS class (to the task box displayed in the grid on the right side) using args.data.box.cssClass
:
dp.onBeforeTaskRender = function (args) {
args.data.box = { bubbleHtml: args.data.box, cssClass: args.data.CssClass };
args.data.row = { bubbleHtml: args.data.row };
};
The fact that the task box isn’t rendered yet when onBeforeTaskRender
is called is not important. The value is saved for later and used during rendering. The onBeforeTaskRender
is called when the task is loaded. But the actual rendering can happen several times (as you scroll the task into the viewport and out).
If this isn’t what you are looking for, can you try posting a screenshot and highlighting your requirement there?
Just a note: Overwriting the args.data.box
and args.data.row
like this is a bit dangerous. These properties are supposed to hold an object with a fixed structure. What you are doing (storing a string there and building the correct structure in onBeforeTaskRender
) will work but it may cause confusion when you (or someone else) will work with the code months later.