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(); }
ctp_9 source share