Datagrid2 has the dynamic classes as advantage. But since it does not have all the features of a datagrid, this might not work for you.
Use datagrid 2 instead.
This is a new and better implementation of the datagrid and allows for element styling.
When using the datagrid 3, you can set dynamic classes in the appearance of the text widget
You can use data grid 2 or make your changes on the CSS files