Wicket 6 IColumn How the name can be of type other

2019-05-24 06:04发布

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();

http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/extensions/markup/html/repeater/data/table/IColumn.html

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 "?"

标签: java wicket
2条回答
迷人小祖宗
2楼-- · 2019-05-24 06:34

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.

查看更多
太酷不给撩
3楼-- · 2019-05-24 06:44

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
查看更多
登录 后发表回答