Closed confile closed 7 years ago
Due to the vaadin definition: https://vaadin.com/docs/-/part/elements/vaadin-grid/formatting.html You have to set a custom cell renderer as:
var currencyRenderer = function(cell) { cell.element.innerHTML = '$' + cell.data; }; grid.columns[1].renderer = currencyRenderer;
The function argument is marked as cell. Looking at the GWT example here:
cell
Column column = grid.getColumns().get(0).cast(); column.setRenderer(row -> { Row r = (Row)row; int n = Integer.valueOf(""+ r.getData()) % 4; String icon = n == 2 ? "star-half" : n == 1 ? "star" : "star-border"; r.getElement().<Element>cast().setInnerHTML("<iron-icon icon='" + icon + "'>");; return null; });
The inner function argument is a row instead of a cell.
row
r.getIndex()
Good catch. We were using a different object, but since both has the getElement method, and they are native elements they were working.
Due to the vaadin definition: https://vaadin.com/docs/-/part/elements/vaadin-grid/formatting.html You have to set a custom cell renderer as:
The function argument is marked as
cell
. Looking at the GWT example here:The inner function argument is a
row
instead of a cell.r.getIndex()
always returns 1