GXT Paging Row Number

I got problem to display the row number for the paging grid.
The value always start from 1 to the end of row in the grid.
After trying several methods (actually several frustrated hours), finally I found the soultion.
It's very simple and I don't believe, why I not think of this before.

Here is the code

final RowNumberer rn = new RowNumberer();
rn.setWidth(30);
rn.setRenderer(new GridCellRenderer() {

public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore store, Grid grid) {
int offset = 0;
if (store.getLoadConfig().get("offset") != null) {
offset = Integer.parseInt(store.getLoadConfig().get("offset").toString());
}
return offset + rowIndex + 1;
}
});

1 comments:

emprice26 said...

Thanks for the example. It was just what I was looking for.

 
Copyright © peyotest