primefaces datatable header复选框选择all of page

时间:2017-05-09 11:55:23

标签: jsf checkbox primefaces datatable pagination

当我按下复选框时,选择表格每个页面上的记录。请帮帮我

procedure TWinControlEx.KeyDown(var Key: Word; Shift: TShiftState);
begin
  if (Key = VK_RETURN) and not (ssCtrl in Shift) then
    Key := VK_TAB;
  inherited;
end;

procedure TWinControlEx.SetFocus;
begin
  // do something and/or call
  inherited;
end;

1 个答案:

答案 0 :(得分:0)

 <p:dataTable var="projectMaterial"  id="projectMaterial" 
                                         paginator="true" paginatorAlwaysVisible="true" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         rows="12" rowsPerPageTemplate="5,10,15" rowSelectMode="true"  
                                         selection="#{pprMaterialAuthorizationBean.selectedMaterialList}" rowKey="#{projectMaterial.id}"  
                                         value="#{pprMaterialAuthorizationBean.materialList}" >

                                <p:column  headerText="#{lang.labelMaterial}" filterBy="#{lang[projectMaterial.materialLangPrm]}" sortBy="#{lang[projectMaterial.materialLangPrm]}" width="40%">
                                    <h:outputText value="#{lang[projectMaterial.materialLangPrm]}" />
                                </p:column>
                                <p:ajax event="toggleSelect" listener="#{pprMaterialAuthorizationBean.selectAllFalas}" update=":form1:projectMaterial"/>
                                <p:column selectionMode="multiple" width="40%"/>
 </p:dataTable>


public void selectAllFalas() {
            if(selectAllFalas == false) {
                selectedMaterialList = (List<HydPipeMaterial>) materialList;
                selectAllFalas = true;
            }else{
                selectedMaterialList = new ArrayList<>();
                selectAllFalas = false;
            }
        }