Change Background Color on Slot in Scheduler (Angular)

1 Answer 618 Views
Scheduler
Mike
Top achievements
Rank 1
Mike asked on 02 Jul 2021, 03:21 PM | edited on 02 Jul 2021, 03:22 PM

This should be pretty easy, in no way will I ever get this working without help ...

The control ...

 <kendo-scheduler  [slotClass]="getSlotClass" >

The code ....

    public getSlotClass = (args: SlotClassArgs) => {

        return {
            background:"purple" // ???????????????????????
          };
      }

Nothing I've tried can set the background color of a slot .... ?

1 Answer, 1 is accepted

Sort by
1
Accepted
Slavena
Telerik team
answered on 07 Jul 2021, 06:26 AM

Hi Mike,

Thank you for the provided code snippets.

The function defined by the slotClass property of the Scheduler returns a value which is supported by ngClass (for example a key: value pair):

return {
   customClass: true
};

Here is an example that demonstrates this approach:

https://stackblitz.com/edit/angular-8eagpv?file=app/app.component.ts

In addition, the encapsulation mode should be set to ViewEncapsulation.None in order for the styles to be applied.

I hope this helps. Let me know if further assistance is required on this case.

Regards,
Slavena
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Mike
Top achievements
Rank 1
commented on 07 Jul 2021, 12:35 PM | edited

Yes, that worked, the only issue I have now is that I would need to know what Resource I am in during getSlotClass() in order to color the backgrounds properly. My resources are doctors and the colors represent clinic's that they are during certain hours. I don't think there is anyway to have varying colors for slots on the same date for different resources.

It would be perfect if the resource was passed in as a property of SlotClassArgs.

Is it possible to determine the resource in getSlotClass() ??
Slavena
Telerik team
commented on 09 Jul 2021, 12:40 PM

Hello Mike,

For further information on this topic please refer to the following private support thread as the discussion will be continued there:

https://www.telerik.com/account/support-tickets/view-ticket/1526896

Regards,
Slavena
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Pawan
Top achievements
Rank 1
commented on 14 Aug 2021, 07:11 AM

If i use the encapsulation then my other styling did not work. How fix this problem
Tags
Scheduler
Asked by
Mike
Top achievements
Rank 1
Answers by
Slavena
Telerik team
Share this question
or