Primefaces数据表选择未选中的复选框行

时间:2017-05-04 11:48:22

标签: jsf primefaces jsf-2 jsf-2.2

您好我使用JSF数据表如下

    <p:dataTable id="group"
       styleClass="table table-striped table-bordered"
       rowSelectMode="checkbox"
       value="#{importIssueController.impIssueStatusArrList}"
       selection="#{importIssueController.selectedIssues}"
       paginator="true" rows="10"
       paginatorTemplate="{CurrentPageReport}  {FirstPageLink}         
       {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
       rowsPerPageTemplate="2,10,15" lazy="true" var="importIssue" rowKey="#{importIssue[0]}">
       <p:column selectionMode="multiple" 
       disabledSelection="#{importIssue[6] == 'yes'}"
       style="width:16px;text-align:center"/>

此处某些行复选框在某些情况下被禁用,用户可以选择已启用复选框的行。 我在这里面临的问题是,即使禁用了复选框,我单击该行并按提交,行也被选中。有没有办法可以处理这个? 我使用的是Primefaces 3.5

1 个答案:

答案 0 :(得分:1)

DataTable中的

使用以下

<p:column selectionMode="multiple"
    styleClass="#{importIssue[6] == 'yes' ? 'selectionDisabled':''}" />

并在css中进行更改

td.selectionDisabled .ui-chkbox{
    display: none;
   }

这将完全隐藏该条件的复选框。使用PF 5代替3.5

相关问题