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
close icon

Row Height

Hi,

I use Datagrid. How can I do the following in css?

1-Reduce padding and margin in cells

2-Reduce the height of the rows

3-Reduce the padding and margin in the header columns

4-Reduce the column header height

How to implement the following image in ButtonGroup



3 Replies

PS Prathap Senthil Syncfusion Team March 9, 2023 01:05 PM UTC

Hi Sarah,

Regarding your query on customizing the Syncfusion Blazor DataGrid using CSS. To address your queries, please refer to the below suggestions.

1.To reduce the padding and margin in cells, you can use the following CSS code:

.e-rowcell {

padding: 20px !important;

margin: 0;

}


2.To reduce the height of the rows, you can customize the row height of DataGrid rows through the RowHeight property. The RowHeight property is used to change the row height of entire DataGrid rows. Please refer to the attached Ug Documentation for your Reference: https://blazor.syncfusion.com/documentation/datagrid/row-height

3.To reduce the padding and margin in the header columns and column header height, you can use the following CSS code:

.e-grid th.e-headercell {

padding: 20px !important;

margin: 0;

height: 50px !important;//for setting height for header row

}


4.To implement the image in ButtonGroup, we suggest using the Template feature. You can customize it at your end. Please refer to the below documentation links for more information:

https://blazor.syncfusion.com/documentation/datagrid/column-template
https://blazor.syncfusion.com/documentation/datagrid/templates


Reference: https://blazor.syncfusion.com/documentation/datagrid/how-to/grid-styling
https://blazor.syncfusion.com/documentation/datagrid/how-to/customize-column-styles
https://blazor.syncfusion.com/documentation/datagrid/cell#customize-cell-styles


Regards,
Prathap S



SA Sarah March 12, 2023 06:03 PM UTC

Hi,

Thank you for your guidance. How can I reduce the height of 1 and 2 in the image below?

1-How can I change the column chooser button font?



2-

To implement the image in ButtonGroup, we suggest using the Template feature. You can customize it at your end. Please refer to the below documentation links for more information:

This question I asked is not related to the data grid component. I want to design a multilingual website and the user can choose the language of the site by clicking on the flag.


3-One problem that I noticed in the multilingual site is that it is not a problem if the default language is ltr. But if I want the default language to be rtl (in program.cs), there is a problem in the Datagrid and the user cannot increase or decrease the width of the columns. But when the user changes the site language to an ltr language and then chooses an rtl language, the problem is solved. I use the following program.cs code.

builder.Services.AddSyncfusionBlazor(options => { options.EnableRtl = true; options.IgnoreScriptIsolation = true; });




TJ Theveshwar Jayakumar Syncfusion Team March 16, 2023 12:02 PM UTC

Thanks for the Update.

To reduce the height of the toolbar and pager in your grid, please use the following CSS code:

.e-grid .e-toolbar .e-toolbar-items{

        height :10px ;

    }

    .e-grid .e-pager {

        height: 10px;

   }


Regarding your second query on changing the column chooser button font, please use the following CSS code:


.e-grid .e-ccdlg .e-footer-content .e-btn{

        font-family: fantasy;

    }

 



Regarding the issue with the inability to increase or decrease the width of the columns, we kindly request that you provide us with more details. Are you facing this issue while using the resizing feature? In order to better understand and resolve your issue, we kindly request that you provide us with a simple reproducible sample. Alternatively, if possible, please try modifying the attached sample to see if the issue can be reproduced there. Please also share with us the issue replication steps or a video demonstration of the issue. We appreciate your cooperation and hope to resolve this issue for you as soon as possible. Kindly refer to the attached sample for your reference.


Attachment: BlazorGrid_b745c54c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon