manipulating button content via clicklistener in grid column

Hi there,

i got a problem refreshing a Button within my Vaadin Flow Grid Component.

i’ve added a Column for a Button which should open a the Grid Details and by doing so, changing its Icon from a visible PLUS, to a MINUS
So my code example looks like this.

grid.addColumn(new ComponentRenderer<>(item -> {
	return new Button(VaadinIcons.PLUS.create(), e -> {
		grid.setDetailsVisible(item, !grid.isDetailsVisible(item));
		e.getSource().setIcon(grid.isDetailsVisible(item) ? VaadinIcons.MINUS.create() : VaadinIcons.PLUS.create());
	});
}));

unfortunatly it won’t reset the actual icon of this button. Even if i wrap everything within

UI.getCurrent().access(() -> {

}

manipulating a simple label outside my grid works perfectly fine with that.
What am i missing here?

Hopefully somebody can help me with that.
Thanks in advance,

Sebastian

okay, sorry for disturbing you.

fixed it.
i noticed that the set icon reference always changes so i guess there is a grid refresh wich renders the column to its original state when the details were opened.

this.basketGrid.addColumn(new ComponentRenderer<>(item -> 
	new Button(this.basketGrid.isDetailsVisible(item) ? VaadinIcons.MINUS.create() : VaadinIcons.PLUS.create(),
	e -> {
		basketGrid.setDetailsVisible(item, !basketGrid.isDetailsVisible(item));
})));

so this works out.

Sebastian