I need for the parent resource a different color - from 186812

 I need for the parent resource a different color

so AUhof = dark green

Buhr Sabine - should be light green

but the first group get the color but the second not.. I need to identify the parent group... but how?

if (args.elementType === "resourceHeader") {
const schedule = this.$refs.schedule as ScheduleComponent;
const resourceDetails: any = schedule.getResourcesByIndex(args.groupIndex);
const groupIndex = args.groupIndex;
debugger;
if (groupIndex % 2 === 0) {
args.element.style.backgroundColor = "#e4f3f8";
} else {
args.element.style.backgroundColor = "#def8da";
}
if (resourceDetails.resource.colorField) {
args.element.style.backgroundColor =
resourceDetails.resourceData[resourceDetails.resource.colorField];
}


1 Reply

AK Ashokkumar Karuppasamy Syncfusion Team February 23, 2024 02:50 PM UTC

Hi Isabelle Fuchs,


You can fulfill your requirement by utilizing the renderCell event. If the event is used, you can render the cell element in the e-parent-node class. If this class is present, you can obtain the parent ID from that element. The attached example demonstrates the solution. Feel free to give it a try, and don't hesitate to reach out if you need further assistance.

Sample: https://stackblitz.com/edit/schedule-resource-id-get-ogrvkk?file=src%2FApp.vue


 onRenderCell: function (args) {

      if (args.elementType === 'resourceHeader') {

        const schedule = this.$refs.schedule as ScheduleComponent;

        const resourceDetailsany = schedule.getResourcesByIndex(args.groupIndex);

        const groupIndex = args.groupIndex;

        if(args.element.classList.contains('e-parent-node')) {

            args.element.style.backgroundColor =

            resourceDetails.resourceData[resourceDetails.resource.colorField];

            console.log("parentId"resourceDetails.resourceData.id)

        }

      }

      if(args.elementType === "workCells") {

        const schedule = this.$refs.schedule as ScheduleComponent;

        const groupIndex = args.groupIndex;

        if (groupIndex % 2 === 0) {

            args.element.style.backgroundColor = "#e4f3f8";

          } else {

            args.element.style.backgroundColor = "#def8da";

          }

      }

    },

  },

 



Regards,

Ashok


Loader.
Up arrow icon