java - Does NatTable need a manual refresh after repaintCell? -
i have following code snippet.
int index = geteventlist().indexof(myobj); selectionlayer selectionlayer = getglazedlistsgridlayer() .getbodylayerstack().getselectionlayer(); getnattable().repaintcell(0,selectionlayer.getrowindexbyposition(index));
when run code shown above, affected cells repainted after click on table displayed in gui. if comment out code , use getnattable().refresh();
repaints without me having first click on table.
is there way have cell repainted without having click on table displayed in gui? hate have call refresh() large table code may executed many times.
no don't need perform additional step in order trigger repainting. issue in code usage of wrong index values. have grid column 0 row header nattable perspective. suppose want redraw first column of body, index 1 nattable point of view. row index incorrect, calculate index in selectionlayer need index in table, @ minimum +1 if have column header row.
actually code should work adding 1 on index if have 1 row header column , 1 column header row in grid.
getnattable().repaintcell(1, selectionlayer.getrowindexbyposition(index) + 1);
Comments
Post a Comment