2017-05-04 105 views
1

您好我使用JSF數據表如下Primefaces數據表中選擇未選中的複選框行

<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

+0

什麼是importIssue [6]的數據類型?字符串還是布爾值? – lastresort

+0

importIssue [6]是字符串類型 – David

+0

您可以像這樣捕獲rowSelectEvent:http://www.kianworknotes.com/2014/10/how-to-disable-row-selection-in.html – lastresort

回答

1

在你的數據表使用以下

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

而且在CSS

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

更改這將徹底隱藏複選框這一條件。使用PF 5而不是3.5