[英]Selection doesn't work in extendedDataTable, RichFaces 4 + JSF 2.0
我有一个带有RichFaces 4.0.0.Final和JSF 2.0的应用程序。 当我尝试在extendedDataTable中使用选择时,它不起作用。
<rich:extendedDataTable
id="shipmentList" value="#{shipmentListBean.shipmentList}" var="shipment"
rowClasses="#{shipment.paymentDate == null ? 'unpaidShipment' : null}"
selectionMode="single" noDataLabel="#{msgs.emptyList}"
selection="#{shipmentListBean.selection}"
style="width: 1200px; font-size: 10px; ">
ShipmentListBean:
@ManagedBean
@ApplicationScoped
public class ShipmentListBean implements Serializable {
private Collection<Object> selection = null;
public ShipmentListBean() {
}
public List<ShipmentValueObject> getShipmentList() {
....
}
public Collection<Object> getSelection() {
return selection;
}
public void setSelection(Collection<Object> selection) {
this.selection = selection;
}
}
为什么在方法selSelection(Collection selection)中选择表中的行会出现空集合?
您可以使用这样的选择
in ShipmentListBean
private SimpleSelection selection = new SimpleSelection();
// now time to get a selected Row id from the extendedDataTable.
// this method you can call on any button after selecting the row from the extendedDataTable
public void selectedRecord(){
try{
Iterator<Object> iterator = getSelection().getKeys();
while(iterator.hasNext()){
// Here you will get all the selected roes id from the Data table
Object obj = iterator.next();
info("GET SELECTED ROWS ID ::::: " + obj.toString());
}
}catch(Exception e){
e.printStackTrace();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.