First of all, I found the Vaadin docs a good place to start looking for help. For the rest of the exercise, suppose we have Gridwith three simple columns c1, c2, and c3:
Grid grid = new Grid();
grid.addColumn("c1", String.class);
grid.addColumn("c2", String.class);
grid.addColumn("c3", String.class);
1.) How to disable the sort function in the header of each column
Go through each column and set its sort property to false:
for (Grid.Column column : grid.getColumns()) {
column.setSortable(false);
}
, , :
grid.getColumn("c1").setSortable(false);
2.) Grid
, CSS theme:
@import "../valo/valo.scss";
@mixin mytheme {
@include valo;
// Insert your own theme rules here
.v-grid-cell.green {
background: #33BB00;
}
}
CellStyleGenerator, :
grid.setCellStyleGenerator(new Grid.CellStyleGenerator() {
@Override
public String getStyle(Grid.CellReference cellReference) {
if ("c1".equals(cellReference.getPropertyId())) {
return "green";
} else {
return null;
}
}
});
- :
