Hi,
Is there any way to apply a CSS class to a DataGrid? I haven't found an ExtendedClass property for the component or the columns.
In particular I need to:
- apply a CSS class to all the text in the DataGrid (I tought to apply the class to a container and put the Grid in it, but it will be better if it can be done directly on the Grid)- apply another CSS class only to a specific column (i know there is ConditionalFormat, but I don't have conditions on which to apply the class)
Thank you.
Hi Raffaele,
One approach to implementing your use case is as follows:
1) To apply a CSS style to all the text in the DataGrid (excluding col header text):
CSS:
.wj-cells .wj-cell { color: red; }
2) To apply a CSS class to a specific column:
//CSS Class: .wj-col-bgcolor { background: yellow !important; } //JS var gridProvider = GridAPI.GridManager.GetGridById($parameters.GridWidgetId)._provider; gridProvider._cols[0].cssClass = "wj-col-bgcolor";
Alternative approach: https://www.outsystems.com/forums/discussion/70022/how-to-add-class-to-column-on-initialize/#Post282548
I hope this helps you!
Kind regards,
Benjith Sam
Thank you for the fast response, it works.
You're welcome, Raffaele. I'm glad it helped you :)