-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Table Selection not cleared from table #15533
Comments
It took me a while to figure out this, had to dig into the code and finally found Example:
@cetincakiroglu This is my first contribution, feel free to assign me more basic issue I would like to contribute and learn. |
Thank you, @yash-kh, for looking into this issue for me. However, your solution did not fix the selection problem. After adding the directive you suggested, the clear button no longer works. I have updated my stackblitz so you see the behavior after adding the directive. |
Hi, can you use the method below. if (table.value && table.value.length > 0) {
table.toggleRowsWithCheckbox(event, false);
} |
@Sinan997 Thank you for your response, but this will resolve the issue of the table visually showing rows as selected, but programmatically showing 0 rows selected (which is correct). |
So, is your problem resolved? |
No, the problem I described is not resolved. The table visually displays more rows selected than are actually selected. |
I am testing in this stackblitz app. Making clear function as below works for me. clear(event: any, table: Table): void {
table.toggleRowsWithCheckbox(event, false);
} |
Hi, So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap? Thanks a lot for your understanding! |
I have switched jobs. I no longer work with PrimeNG. This is their problem
now.
Thank you for following up!
Laura Slocum
…On Mon, Dec 16, 2024, 6:05 AM Mert Sincan ***@***.***> wrote:
Hi,
So sorry for the delayed response! Improvements have been made to many
components recently, both in terms of performance and enhancement.
Therefore, this improvement may have been developed in another issue ticket
without realizing it. You can check this in the documentation. If there is
no improvement on this, can you open a new issue so we can include it in
our roadmap?
Thanks a lot for your understanding!
Best Regards,
—
Reply to this email directly, view it on GitHub
<#15533 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEUTODUHHX74TS5AZNIZBVT2F26ZTAVCNFSM6AAAAABTV7S4QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBVGQ2TAOBZGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Describe the bug
When the table is in multi-select mode, there is no clear and easy way to clear the selection programmatically. The documentation says you just need to set the selected items array to
[]
in the component. However, the table UI does not unselect the values.Environment
Any
Reproducer
https://stackblitz.com/edit/primeng-tableselection-demo-hsxykw
Angular version
"~16.2.12",
PrimeNG version
"~16.4.3"
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18 LTS
Browser(s)
Chrome and Edge, haven't tested in others.
Steps to reproduce the behavior
Scenario:
The table has one or more rows selected. The user clicks the clear button to remove the table selection.
The table component (wrapped in my component library)
clear()
andclearSelectionRange()
on the table.[]
The component using the table from the component library receives the selection change event and sets its selected items array to the value sent on the event (
[]
)The user sees no visual change to the table; all rows appear to be still selected. Console logging the values shows the events are sending the correct values. Both the table and consuming components have no selected items.
The user clicks to select another row (just one), and the console logs show multiple rows selected.
Expected behavior
The table reflects the unselected rows. When selecting a row after clearing values, only selects the row that was clicked.
The text was updated successfully, but these errors were encountered: