Highlight Rows with GWT CellTable

I created a CellTable with 300+ rows divided into pages 20. I have a command in my menu that allows the user to select rows based on values ​​in a certain column (similar to conditional formatting in Excel).

I need help changing line styles for lines that are not on the current page.

I looked at the Celltable and SimplePager docs but nothing popped up on me. I am very new to GWT, so any help would be greatly appreciated.

+4
source share
1 answer

I created a function that looked like this (where redRow and yellowRow are styles in my CSS):

private void highlightAlerts() { alertHighlight = true; Range range = siteTable.getVisibleRange(); int start = range.getStart(); for (int i=0; i<siteTable.getPageSize(); i++) { if (dataProvider.getList().get(start+i).alert.equals("Error")) siteTable.getRowElement(i).setClassName("redRow"); else if (dataProvider.getList().get(start+i).alert.equals("Warning")) siteTable.getRowElement(i).setClassName("yellowRow"); } 

Then, in my pager, I added this to onRowOrRowCountChanged () so that the styles persist when the user views the table's pages:

 protected void onRangeOrRowCountChanged() { super.onRowOrRountCountChanged(); if (alertHighlight) highlightAlerts(); } 
+5
source

Source: https://habr.com/ru/post/1414205/


All Articles