Interface IColumn contains a method getSortProperty(), which returns a value of any type S. How the name can be of type other than string?
/**
* Returns the name of the property that this header sorts. If null is returned the header will
* be unsortable.
*
* @return the sort property
*/
S getSortProperty();
In wicket older version 6:
PropertyColumn<SomeClass> column = new PropertyColumn(Model.of("Header"), "sortProperty", "propertyExpression");
Wicket 6: description:
PropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression);
example:
PropertyColumn<SomeClass, Long> column = new PropertyColumn(Model.of("Header"), ?, "propertyExpression");
what to write on the ground "?"
In your example using a PropertyColumn<SomeClass, Long>
you have to use a Long
value as the second parameter, as this is the type of the sort property.
If your sort property is a String, simply use PropertyColumn<SomeClass, String>
and pass your property to the constructor.
javadoc at http://wicket.apache.org/apidocs/1.5/org/apache/wicket/extensions/markup/html/repeater/data/table/IColumn.html says
getSortProperty
java.lang.String getSortProperty()
Returns the name of the property that this header sorts. If null is returned the header will be unsortable.
Returns:
a string representing the sort property
来源:https://stackoverflow.com/questions/13864075/wicket-6-icolumn-how-the-name-can-be-of-type-other-than-string