Change font size and color

Dear Syncfusion Team,

I would like to change the font size and color in some lines of the SfTreeGrid, based on the content. I found your example, so I created an onRowDataBound event handler:

void onRowDataBound(RowDataBoundEventArgs<IncomeStatementData> args)
    {
        IncomeStatementData myArgs = args.Data;
        if ((myArgs.OldAccountNo != null) && (myArgs.OldAccountNo.StartsWith("X")))
        {
            args.Row.AddClass(new string[] { "MainLine" });
        }
        else if (myArgs.OldAccountNo == null)
        {
            args.Row.AddClass(new string[] { "Level1Line" });
        }
        else if ((myArgs.OldAccountNo != null) && (myArgs.OldAccountNo.Length ==2))
        {
            args.Row.AddClass(new string[] { "Level2Line" });
        }
    }

and I added a style:

<style>
    .MainLine
    {
        font-weight: bold;
        font-size: 32px;
    }
    .Level1Line
    {
        font-weight: bold;
        font-size: 12px;
        color: #66b3ff;
    }
    .Level2Line
    {
        font-weight: bold;
        font-size: 12px;
    }
</style>

However it seems the font color and the size is not changeable: all the lines are black and all of them are with the same font size.

How can I change the font color and the size, please?


4 Replies 1 reply marked as answer

PS Pon Selva Jeganathan Syncfusion Team January 6, 2022 03:31 PM UTC

Hi Andy Richard, 
  
Thanks for contacting syncfusion forum. 

 

Query: GridForeignColumn not working

  
Currently, We don’t have the Foreign Key support in TreeGrid(i.e. the Foreignkey column dataSource which is separate from the TreeGrid dataSource). But we can use self-referential data support which has the foreign key relationship within them. 
  
Refer the below help links,  
  
Kindly get back to us for further assistance.  
  
Regards, 
Pon selva 



PS Pon Selva Jeganathan Syncfusion Team January 6, 2022 03:35 PM UTC

  
Hi Peter, 
  
Thanks for contacting syncfusion forum. please ignore the previous update. 
  
Query: How can I change the font color and the size, please? 
  
Based on your query, you can achieve your query by using QueryCellInfo event of the treegrid. And we have already discussed the same in following help document.   
  
Please refer the below help documentation :   
  
Kindly get back to us for further assistance.  
  
Regards, 
Pon selva 


Marked as answer

PE Peter January 7, 2022 09:37 AM UTC

Dear Pon, thank you to point me to the appropriate documentation part.

Nota Bene: I had to include the !important tag too to apply the color change, but now all is OK.



PS Pon Selva Jeganathan Syncfusion Team January 10, 2022 02:25 PM UTC

Hi Peter 
 
Thanks for the update. 
 
We are glad to hear your query has been solved by our solution. 
 
Kindly get back to us for further assistance. We are happy to assist you. 
 
Regards, 
Pon selva 


Loader.
Up arrow icon