简体   繁体   中英

PrimeFaces 12.0.0 DataTable disabledSelection behaviour

Am i missing something or PF 12.0.0 DataTable selection is not working as expected when using disabledSelection ?

  1. client-side does not have any CSS class to differentiate between selectable an non-selectable rows
  2. select all checkbox in column header ( <p:column selectionMode="multiple"> ) selects rows (not just selectable?,) - by this i mean, browser is sending form parameter myForm:myTable_selection:@all and then server sets list item from value to selection - at the same time, only selecteble rows are checked on client side 行(不仅仅是可选的?,) - 我的意思是,浏览器正在发送表单参数myForm:myTable_selection:@all然后服务器设置列出从valueselection的项目 - 同时,仅在客户端检查可选择的行
  3. If selectionMode=multiple is present in p:dataTable then it's not working at all (by 'not working at all' i mean client-side checkboxes are all disabled without console error logs)? Only if selectionMode is omitted it's working but still, because of 2) i need to filter out rows on server side manually

I'm using something like this (without Ajax events for row select)

<h:form id="tblForm">
    <p:dataTable id="myTable" widgetVar="myTableWv" value="#{myBean.list}" var="item" size="small" 
                    sortBy="#{myBean.defaultSort}" filterBy="#{myBean.defaultFilter}"
                    selection="#{myBean.listOfSelected}" selectionPageOnly="false" 
                    rowKey="#{item.id}" disabledSelection="#{myBean.shouldDisable(item)}">
        <p:column selectionMode="multiple" />
        <p:column>
            <f:facet name="header">
                <p:commandButton process="@this myTable" action="#{myBean.doSomethingWithSelectedItems}" />
            </f:facet>
        </p:column>
    </p:dataTable>
</h:form>

Edit: 12.0.2 release notes are saying 1) is solved

Edit2: It's not working only when selectionPageOnly=false is used

OK turns out it was a similar issue to previously reported. The issue was not checking if the selection was also disabled!

Fixed here for 13.0: https://github.com/primefaces/primefaces/pull/9553

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM