Jan366
(Jan Reinartz)
October 8, 2020, 10:56am
1
Hello,
is it possible to recalculate column widths after column is sorted.
The following code is not working. I guess the listener is fired before sorting is done and the data is repainted in grid…
addSortListener(l -> {
recalculateColumnWidths();
});
Best
Jan
Tarek15
(Tarek Oraby)
October 8, 2020, 12:43pm
2
Jan366
(Jan Reinartz)
October 8, 2020, 1:12pm
3
Tanks for your reply!
Yes, something like this. But i need to fire recalculateColumnWidths();
after the sorting is done.
Tarek15
(Tarek Oraby)
October 8, 2020, 3:00pm
4
Jan366
(Jan Reinartz)
October 9, 2020, 7:12am
5
Thank you! It works perfectly! This is the code inside my Grid
addSortListener(l -> {
Page page = UI.getCurrent().getPage();
page.executeJs("$0.$server.recalculateColumnWidths()",getElement());
});
and
@Override
@ClientCallable
public void recalculateColumnWidths() {
super.recalculateColumnWidths();
}