How to re-render a table after a new entry was added?

Hi all,

I have a table where one row is marked with an icon and the font is bold by using an icon provider and a style provider (with the install notation). (example image below, sorry it is in German).

The marked row contains data that is fulfilling a certain criteria let’s say it has the item with the highest temperature.

When I add a new item, it appears in the table but it may be that it is now the one with the highest temperature. I have to close the screen and reopen it again to see the row of that item marked correctly.

What can I do to do that without closing the screen? I tried to reload the data loader on collection change event, I tried to call table.repaint() but to no success.

Any hints are appreciated! :slight_smile:

image

Hello!

I’ve tried to reproduce the problem but without success. I added iconProvider, styleProvider and they are applied to new row. Could you share the code where you assign styles or share example of screen in separated demo project?

My code the following:

@Install(to = "projectStatisticsesTable", subject = "styleProvider")
protected String projectStatisticsesTableStyleProvider(final ProjectStatistics entity, final String property) {
    if (isMaxTaskCount(entity)) {
        return "row-bold";
    }
    return null;
}

@Install(to = "projectStatisticsesTable", subject = "iconProvider")
protected String projectStatisticsesTableIconProvider(final ProjectStatistics projectStatistics) {
    if (isMaxTaskCount(projectStatistics)) {
        return JmixIcon.ASTERISK.source();
    }
    return null;
}

styleicon

Hi Roman,

Thank you for your effort to code an example and make a gif of it, that put me on the right track. After carefull analysis, I found a bugin my code where it was decided which item to mark. In addition to that, my debugger was acting out and did not break on the breakpoints I put in the styleProvider code. That led me to the conclusion that the items are not rendered after a change.
It is all working now, thanks again!

1 Like