How to use CSS for NatTables

129 Views Asked by At

How can I style a NatTable using CSS?

This page shows a snippet that should explain how to use CSS for Nattables.

To create a CSS style definition, the general selector NatTable can be used. Additionally a class or id based selector can be used. For example you can create a class based style definition

.basic {
    cell-background-color: white;
    text-align: left;
}

And then configure that class for a NatTable instance via setData().

natTable.setData(CSSSWTConstants.CSS_CLASS_NAME_KEY, "basic");

But it's unclear how to tell the NatTable (or eclipse) where to look for that CSS file.

1

There are 1 best solutions below

0
Dirk Fauth On

NatTable CSS styling is based on Eclipse 4 CSS styling. For details on Eclipse 4 CSS styling have a look at corresponding tutorials like

https://www.vogella.com/tutorials/Eclipse4CSS/article.html https://wiki.eclipse.org/Eclipse4/RCP/CSS