本文介绍了使检票口数据表的整个行都可单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使Wicket DataTable的整个行都可单击?如果是这样,如何?
我已经看到了如何通过扩展PropertyColumn类来使单元格可单击的示例,这相当简单,但找不到整行的简单解决方案。
//覆盖此方法DataTable类
@Override
受保护的项目< T> newRowItem(String id,int index,最终IModel< T>模型){
Item< T> rowItem = new Item< T>(id,索引,模型);
rowItem.add(new AjaxEventBehavior( onclick){
private static final long serialVersionUID = 672051249301721010281L;
@Override
受保护的void onEvent( AjaxRequestTarget target){
//回调或执行某些操作
}
});
return rowItem;
}
Is it possible to make the entire row of a Wicket DataTable clickable ? if so, how ?I've seen examples of how to make a cell clickable by extending the PropertyColumn class, which is fairly easy but can't find an easy solution for the entire row.
解决方案
this do the work.
//override this method of the DataTable class
@Override
protected Item<T> newRowItem(String id, int index, final IModel<T> model) {
Item<T> rowItem = new Item<T>(id, index, model);
rowItem.add(new AjaxEventBehavior("onclick") {
private static final long serialVersionUID = 6720512493017210281L;
@Override
protected void onEvent(AjaxRequestTarget target) {
//callback or do some stuff
}
});
return rowItem;
}
这篇关于使检票口数据表的整个行都可单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-08 19:10