Different formatting for different grids
CSS is not a strong suit for me so I'm not sure how to change the code from here. I have multiple grids on a page and I would like to style them differently. I have read
https://ej2.syncfusion.com/vue/documentation/grid/style-and-appearance/
but when I change a style it affects all of my grids. How can I use the grid id to only change that one?
Also is it possible to center the text on the header but left align in the cell?
Thanks for your help
SIGN IN To post a reply.
3 Replies
JC
Joseph Christ Nithin Issack
Syncfusion Team
August 26, 2021 12:37 PM UTC
Hi William,
Greetings from Syncfusion support.
Based o your query you are having multiple grids on the same page, you want to style them differently. You can achieve this requirement by adding the respected id of the grid when defining the css class.
Please refer the below code example.
|
#grid1.e-grid tbody {
background-color: lightyellow;
}
#grid1.e-grid .e-gridheader th {
background-color: lightblue;
}
#grid2.e-grid tbody {
background-color: lightcyan;
}
#grid2.e-grid .e-gridheader th {
background-color: lightpink;
}
|
Please find the attached sample and revert for more queries.
Regards,
Joseph I.
WM
William Morgenweck
August 27, 2021 11:30 AM UTC
Thank you very much-- I was having trouble with a grid that was on an injected page. The only other area is
Is it possible to center the text on the header but left align in the cell?
I've tried
text-align: center; in the css but that does not seem to work
Thank
JC
Joseph Christ Nithin Issack
Syncfusion Team
August 30, 2021 01:47 PM UTC
Hi William,
Thanks for the update.
Based on your query you want to align the header text in your grid to the center. Your requirement can be achieved using the `column.headerTextAlign` property of the EJ2 grid.
Please refer the below code example.
|
<e-column field="OrderID"
headerText="ID"
width="180"
isPrimaryKey="true"
headerTextAlign="center"></e-column>
|
Please find the attached sample and revert for more queries.
Regards,
Joseph I.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
WM William Morgenweck
- Aug 25, 2021 09:30 AM UTC
- Aug 30, 2021 01:47 PM UTC