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: Row remains selected after clearing backing bean #7391
Comments
@melloware @christophs78 do we have a integration test for this? |
We have tons of selection tests. Let me add this specific case and see. |
integration moved to this repo now, feel free to work on it :) |
Failing Integration Test provided. |
here is a workaround for now. Give your Datatable a widgetVar like <p:commandButton
process="@this"
update="@form"
value="Unselect row"
action="#{testView.unselectRow}"
onclick="PF('selectTable').clearSelections();"
oncomplete="PF('selectTable').unselectAllRows();" /> |
Did this work in 8.0? |
Looks like it did in 8.0 the selection is cleared. Attached is 8.0 reproducer. |
That's what I'm doing for now. Indeed I am checking if there were validation errors because I don't want to unselect the row if the action (business logic) could not be done. For example:
|
When I debug 8.0 vs 10.0 in the Javascript for setupSelection: function() {
this.selectionHolder = this.jqId + '_selection';
this.cfg.rowSelectMode = this.cfg.rowSelectMode||'new';
this.rowSelector = '> tr.ui-widget-content.ui-datatable-selectable';
this.cfg.disabledTextSelection = this.cfg.disabledTextSelection === false ? false : true;
this.cfg.selectionPageOnly = this.cfg.selectionPageOnly === false ? !this.cfg.paginator : true;
this.rowSelectorForRowClick = this.cfg.rowSelector||'td:not(.ui-column-unselectable):not(.ui-grouped-column),span:not(.ui-c)';
var preselection = $(this.selectionHolder).val(); Investigating more. |
I think its the SelectionFetaure does a |
Figured it out. Thanks for the reproducer helping me debug it! |
Working properly with version 10.0.6. Thanks! |
Describe the defect
Basic datatable with single selection: when a row is selected and an action that clears the backing bean selected row object is executed, the row remains selected in the browser.
This only happens when the datatable has declared the "rowSelect" event.
Reproducer
Run the attached project (mvn jetty:run) and visit http://localhost:8080/primefaces-test/. Then select a row and click "Unselect row" button. The row remains selected in the browser.
It works fine (the row is no longer selected) if you comment out the following line in test.xhtml:
Environment:
primefaces-test-master.zip
The text was updated successfully, but these errors were encountered: