Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeFaces 12.0.0 DataTable disabledSelection behaviour

Tags:

jsf

primefaces

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 all rows (not just selectable ?!) - by this i mean, browser is sending form parameter myForm:myTable_selection:@all and then server sets every list item from value to selection - at the same time, only selecteble rows are checked on client side
  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

like image 691
Nikola Avatar asked May 15 '26 00:05

Nikola


1 Answers

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

like image 171
Melloware Avatar answered May 18 '26 09:05

Melloware



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!