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

Kendo Grid Group Styling

6 Answers 2046 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 15 May 2018, 12:55 PM

     Good morning, I am trying to add some Styling to our Kendo Grid, and it is around the Grouping we have applied.

Attached is what I am trying to do, but I can't seem to find a style to work.  Is there anyway to achieve this desired style.

 

Thanks,

Bill

6 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 17 May 2018, 06:26 AM
Hi Bill,

You can overwrite the built-in Grid styling by targeting the respective selectors and providing the desired CSS rules, e.g.:

styles: [`
    >>> .k-grid .k-grouping-row td {
      background-color: blue;
      color: white;
    }
 
    >>> .k-grid .k-grouping-row .k-icon {
      color: white;
    }
 
    >>> .k-grid td.k-group-cell {
      background-color: darkgrey;
    }
  `]

https://stackblitz.com/edit/angular-fvrztr-pzzukc?file=app/app.component.ts

The most straight-forward approach for finding the required CSS selectors is to inspect the elements that need to be customized in the browser developer tools (F12) and check the respective selectors and currently applied rules, e.g.:



Note that to "penetrate" the Grid component's default encapsulation, you will need to either provide the custom styles globally, set ViewEncapsulation of the Host component to None, or use the shadow-piercing descendant combinators:

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

https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
1
Bill
Top achievements
Rank 1
answered on 17 May 2018, 03:07 PM
So that is typically how I do it, the only problem is that we are grouping on two different columns, and we want the two grouped columns to have different colors.
1
Dimiter Topalov
Telerik team
answered on 18 May 2018, 06:53 AM
Hi Bill,

You can customize the styling further by providing a selector that will target TD elements in ".k-grouping-row" and another one for TD elements that are immediately after a ".k-group-cell" element (for the second-level group headers):

[`
 
    >>> .k-grid .k-grouping-row .k-icon,
    >>> .k-grid .k-grouping-row td {
      color: white;
    }
 
    >>> .k-grid .k-grouping-row td { background-color: blue; }
    >>> .k-grid .k-grouping-row .k-group-cell+td { background-color: green; }
 
    >>> .k-grid td.k-group-cell {
      background-color: darkgrey;
    }
  `]

https://stackblitz.com/edit/angular-fvrztr-askbzg?file=app/app.component.ts

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mouton
Top achievements
Rank 1
answered on 23 Sep 2018, 11:10 PM

I put a split button inside a command cell in a kendo grid.

The drop down of the split button didn't overflow the cell and was hidden.

This post helped me to fix this issue using the following css:

::ng-deep .k-command-cell {
            overflow: visible !important;
        }

 

Thank you!!

 

 

 

 

0
Vinay Kumar
Top achievements
Rank 1
answered on 19 Jun 2020, 08:50 PM

Hi Bill

Along with Styling the cell (Like adding color to the cell), I need to group the rows and add pagination. Rows may be around 1000. Can You solve it?

I had done it. But, there was a problem with that. I lost the pagination. But, styles was applied around 100 records and remaining rows I can not see the pages as it lost the pagination.

 

Thank you

Vinay

0
Dimiter Topalov
Telerik team
answered on 23 Jun 2020, 07:23 AM

Hello Vinay,

Can you please explain the scenario in further details? Does it involve a Grid with both grouping and paging? What does "it lost the pagination" mean?

I prepared a simple example of a Grid with both grouping and paging where all group rows are highlighted:

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

Please inspect it, and apply the necessary adjustments to your implementation.

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.
Tags
General Discussions
Asked by
Bill
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Bill
Top achievements
Rank 1
Mouton
Top achievements
Rank 1
Vinay Kumar
Top achievements
Rank 1
Share this question
or