Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: Pre selected disabled rows are dismissed on serverside #11356

Open
pfumi opened this issue Jan 31, 2024 · 4 comments
Open

DataTable: Pre selected disabled rows are dismissed on serverside #11356

pfumi opened this issue Jan 31, 2024 · 4 comments
Labels
discussion Item needs to be discussed by core devs

Comments

@pfumi
Copy link
Contributor

pfumi commented Jan 31, 2024

Describe the bug

If a DataTable is submitted with a disabled row which is checked, then the selection on serverside is updated and dismisses the disabled checked row.

There were multiple issues with disabled rows in DataTable, some were fixed here #11290. One still persists, see my comment here #11290 (comment)

Reproducer

  1. Start the reproducer primefaces-14.0.0-test-master.zip or primefaces-test-master.zip
  2. The first row (enabled) is checked, and the second row (disabled) is checked
  3. Click on the button "Submit"
  4. The first row is still checked, but the second row is unchecked

Expected behavior

All checked rows, either disabled or not, should be kept in the selection list on serverside.

PrimeFaces edition

Community, Elite

PrimeFaces version

14.0.0-SNAPSHOT, 13.0.4

Theme

No response

JSF implementation

Mojarra

JSF version

2.2

Java version

8

Browser(s)

No response

@pfumi pfumi added ‼️ needs-triage Issue needs triaging 🐞 defect Bug...Something isn't working labels Jan 31, 2024
@melloware
Copy link
Member

This is the same issue right? Disabled rows are being ignored on the server side submit just like normal HTML checkbox behavior correct?

@melloware melloware added discussion Item needs to be discussed by core devs and removed 🐞 defect Bug...Something isn't working ‼️ needs-triage Issue needs triaging labels Jan 31, 2024
@pfumi
Copy link
Contributor Author

pfumi commented Jan 31, 2024

Yeah is the same, just wanted to create a new one because the other one is allready closed.

@melloware
Copy link
Member

cc @Rapster @christophs78 @tandraschko @jepsar we need to discuss and decide what to do here.

Summary: When you use disabledSelection="#{xxx}" that will evaluate and prevent any row from being marked selected and was fixed in issue: #9552 I think this is the correct behavior. It works the same as an HTML Checkbox that is disabled the submitted value is ignored/not applied.

@pfumi would like that if he marks something selected on the backend that it shows up Selected AND Disabled on the UI (which it does). But when he submits those disabled records are being unchecked because of #9552.

So we need to decide what to do here but we cannot satisfy both scenarios I don't think. And my two cents is the current behavior is correct.

@Rapster
Copy link
Member

Rapster commented Feb 1, 2024

The current behavior is the right one, there is a very simple reason as of why there is this disabledSelection check once selection is submitted. Let's say, you have items you don't want be able to select, if you don't have that disabledSelection check, you can simply modify the input state holder (in the HTML) to force the selection of these unselectable items.

For your issue, every time you submitted your action, remember to add the disabled items to the list you want before you call your action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Item needs to be discussed by core devs
Projects
None yet
Development

No branches or pull requests

3 participants