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

fix(TreeTable): prevent selection when selectable is set to false (checkbox mode) #6855

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

KumJungMin
Copy link
Contributor

Defect Fixes

How To Resolve

Description

  • When selectionMode is set to "checkbox",
  • there is an issue where the checkbox gets selected, even if the selectable property is set to false.
<TreeTable 
	v-model:selectionKeys="selectedKey" 
	:value="nodes" 
	selectionMode="checkbox" // selectionMode is checkbox
	>  
    <Column field="name" header="Name" expander style="width: 34%"></Column>
    <Column field="size" header="Size" style="width: 33%"></Column>
    <Column field="type" header="Type" style="width: 33%"></Column>
</TreeTable>

  • To resolve this issue, the checkbox is set to disabled when node.selectable is false.
// BodyCell.vue

<Checkbox
      v-if="checkboxSelectionMode && columnProp('expander')"
      :modelValue="checked"
      :binary="true"
      :class="cx('pcNodeCheckbox')"
      :disabled="node.selectable === false" // added
      ...
  >
...

Test

before: when node.selectable is false, but the checkbox is clickable

// data

[
  { key: '0', data: {}, children: [{ key: '0-0', data, ...}, ... ], selectable: false }, 
  { key: '1', data: {}, children: [ ... ], selectable: false }
]
before.mov

after: when node.selectable is false, but the checkbox is unclickable

// data

[
  { key: '0', data: {}, children: [{ key: '0-0', data, ...}, ... ], selectable: false }, 
  { key: '1', data: {}, children: [ ... ], selectable: false }
]
2024-11-25.9.28.22.mov

Copy link

vercel bot commented Nov 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 1:35pm
primevue-v3 ⬜️ Ignored (Inspect) Visit Preview Nov 25, 2024 1:35pm

@KumJungMin
Copy link
Contributor Author

KumJungMin commented Nov 25, 2024

Question

  • Currently, the checkbox click can be restricted for a single row, similar to single mode.
  • If the intended behavior is to also restrict the checkbox click for child rows when the parent row is restricted,
  • I will make additional modifications. Please provide your comments :)


current: restrict checkbox selection for rows with selectable set to false.

스크린샷 2024-11-25 오후 10 37 50



if you want: restrict checkbox selection for child elements of rows with selectable set to false.
스크린샷 2024-11-25 오후 10 37 21

@tugcekucukoglu tugcekucukoglu merged commit 9959769 into primefaces:master Nov 26, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TreeTable: Checkbox selectable does not work
2 participants