This is a migrated thread and some comments may be shown as answers.

Kendo Grid Angular - Styles not working

2 Answers 4072 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Akarsh
Top achievements
Rank 1
Veteran
Akarsh asked on 23 Apr 2020, 04:02 AM

Am not able to change the style for kendo grid,  Even i written script in component.scss, still not working. Weird ! Why so?

Once i changed to  encapsulation: ViewEncapsulation.None, its started working , whats the logic behind that?

 

Thanks....

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 24 Apr 2020, 06:04 AM

Hi Akarsh,

This is the default Angular behavior to help encapsulate component styling. The idea is that each component is a separate standalone unit, and its styling and logic should not affect other components (unless specifically configured so by the developer):

https://angular.io/guide/component-styles

https://angular.io/guide/component-styles#style-scope

https://angular.io/guide/component-styles#view-encapsulation

To customize the styling of nested Angular components used in the host component's template (including the Kendo UI for Angular components), the custom styling should be either provided at a global level (for example in the application's styles.css file), or the ViewEncapsulation of the host component should be set to None.

Here is an example demonstrating overwriting the Grid colors with CSS rules, declared in the index.html file (without setting the ViewEncapsulation to None):

https://stackblitz.com/edit/angular-mhxas7?file=index.html

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Akarsh
Top achievements
Rank 1
Veteran
answered on 24 Apr 2020, 08:22 AM
Hey thanks, Now i got the clear picture..
Tags
General Discussions
Asked by
Akarsh
Top achievements
Rank 1
Veteran
Answers by
Dimiter Topalov
Telerik team
Akarsh
Top achievements
Rank 1
Veteran
Share this question
or