Hello,
I use Tapestry 5.1.0.5
My goal is to add a column to a grid and to make it sortable.
Of course, this column is not part of the grid datasource (otherwise I wouldn't need to add it).
I have written a page based on example provided here:
http://wiki.apache.org/tapestry/Tapestry5GridComponentEverything seems to be ok (up and down arrows are displaid), but when I try to sort on this additionnal column, I get a nullpointer exception. (but when I try to sort on other columns it still works).
So, I guess I've done something unporperly, but I don't manage to find what. Do u have any idea?
Here is the error :
java.lang.NullPointerException
org.apache.tapestry5.internal.grid.CollectionGridDataSource$2.compare(CollectionGridDataSource.java:78)
org.apache.tapestry5.internal.grid.CollectionGridDataSource$3.compare(CollectionGridDataSource.java:91)
java.util.Arrays.mergeSort(Arrays.java:1284)
Here is my class page :
public class UploadsIndex {
@Inject
private UploadManager uploadManager;
/** The model. */
@Retain
private BeanModel beanModel;
/** The bean model source. */
@Inject
private BeanModelSource beanModelSource;
/** The resources. */
@Inject
private Messages messages;
void pageLoaded() {
beanModel=beanModelSource.createEditModel(Upload.class, messages);
PropertyModel dModel= beanModel.add("download",null);
dModel.sortable(true);
}
public BeanModel getBeanModel() {
return beanModel;
}
public List<Upload> getAllUploads() {
return uploadManager.findAll();
}
@Property
private Upload upload;
}
And here is the tml page :
...
<body>
<h1>All Uploads</h1>
<t:grid t:id="grid" t:source="allUploads" row="upload" exclude="uploadId" t:model="beanModel" >
<t:parameter name="downloadCell">
<t:actionlink t:id="downloadUpload" context="upload.uploadId">${upload.name}</t:actionlink>
</t:parameter>
</t:grid>
</body>
...
Thanks For your help!
Kind Regards
Emmanuel