We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom CSs

Hi

In Treegrid Component need to apply the custom CSS. Could you please Let me know the solution as soon as possible .

Thanks in Advance 

Regards,

Sunithra.C

1 Reply

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team May 24, 2019 04:46 AM

Hi Sunithra, 

Thanks for contacting Syncfusion Support. 

QUERY: Need to apply Custom CSS in TreeGrid 
 
In Syncfusion we have “Theme Studio” to customize new themes for our components. It supports TreeGrid Component. You can use this Theme Studio for customizing the TreeGrid. Please refer to the below link, 

Also please refer to the attached document to modify the TreeGrid appearance by overriding the default CSS of the TreeGrid.  

We have logged a task to create “how to section” for styling the TreeGrid Component in our Documentation Page. We will let you know once it is refreshed. 

In TreeGrid, we also have “cutomAttribute” API . Using this, the CSS styles and attributes of the content cells of a particular column can be customized. Please refer the below help documentation, 

You can customize the grid cells by adding a CSS class to the customAttribute property of the column. 


In app.style.css 

.e-attr { 
    background: #d7f0f4; 


    field: taskID, headerText: 'Task ID', customAttributes: {class: 'e-attr'}, width: '90' 


In the below example, we have customized the cells of OrderID and ShipCity columns. 


In app.component.ts 

import { Component, OnInit, ViewEncapsulation } from '@angular/core'; 
import { sampleData } from './datasource'; 

@Component({ 
    selector: 'app-root', 
    template: `<ejs-treegrid [dataSource]='data' height='300' [treeColumnIndex]='1' childMapping='subtasks' > 
        <e-columns> 
                    <e-column field='taskID' headerText='Task ID' [customAttributes]="{class: 'e-attr'}" 
                    textAlign='Right' width=90></e-column> 
                            -------------------------- 
        </e-columns> 
                </ejs-treegrid>`, 
                styleUrls: ['app.style.css'], 
                encapsulation: ViewEncapsulation.None, 

}) 
export class AppComponent implements OnInit { 
       ------------------ 

Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 


Loader.
Live Chat Icon For mobile
Up arrow icon