Skip to content

Instantly share code, notes, and snippets.

@uklance
Last active December 31, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uklance/8003728 to your computer and use it in GitHub Desktop.
Save uklance/8003728 to your computer and use it in GitHub Desktop.
<!-- page.tml -->
<t:grid source="myCustomGridDataSource" ... />
// Page.java
public GridDataSource getMyCustomGridDataSource() {
final List<Document> docs = documentDAO.getAll();
GridDataSource wrapper = new CollectionGridDataSource(docs) {
public int getAvailableRows() {
return super.getAvailableRows() + 1;
}
public Object getRowValue(int index) {
if (index < docs.size()) {
return super.getRowValue(index);
}
return new Document();
}
};
return wrapper;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment