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

Add selectionAutoFocus property to DataTable #2575

Closed
ursfan opened this issue Jan 12, 2022 · 2 comments
Closed

Add selectionAutoFocus property to DataTable #2575

ursfan opened this issue Jan 12, 2022 · 2 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@ursfan
Copy link

ursfan commented Jan 12, 2022

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Current behavior
There is an option for the Datatable to have a Checkbox-Only Selection of a Row. Anyway when I click on any column of the row the Checkbox gets focused. This has some unwanted effects in combination with some other features of the Datatable.

  1. horizontal scrolling I have a table with a menu button in the last column which is only visible when the table is scrolled to the most right. Immediately when I click on the button with the contextmenu the table scrolls to the left and focuses the checkbox, so there is no chance to click on any entry of the menu.
  2. InputGroup with DropDown as cellEditor. Immediately when I select one of the entries of the DropDown the editor is closed and no longer visible. Instead the Checkbox of a column is focused.

At the moment I don't see a chance to disable this behavior of the table by the given options so far. The RowCheckbox component of datatable has no props to change the onFocus function. Maybe there could be a ColumnCheckBox for the datatable component instead for that case.

Expected behavior
When the option Checkbox-Only Selection is used, the focus should be set for the checkbox only, when it is clicked by the user or the direct column of the checkbox is focused. A click on other columns of the row shouldn't have any effect to the checkbox at all.

Minimal reproduction of the problem with instructions
For both cases the example for Edit of the Datatable in the showcase can be used. For v6.6.0 the first example table has one column with a DropDown as cell editor. For the second case In the codesandbox can be added the Selection and an Inputgroup to the DropDown of the cell editor. For the first case there has to be added horizontal scrolling by some additional columns and a menu button in the last or any column not visible without scrolling.

  • React version:
    17

  • PrimeReact version:
    6.6 and 7.1

@ursfan
Copy link
Author

ursfan commented Jan 12, 2022

I found a workaround for the problem. When I use the onRowClick callback function and change the originalEvent of the event handed over, it works as expected.

@mertsincan mertsincan self-assigned this Jan 14, 2022
@mertsincan mertsincan changed the title Datatable Checkbox-Only Selection shouldn't call Checkbox onFocus on any column Add selectionAutoFocus property to DataTable Jan 14, 2022
@mertsincan mertsincan added the Type: New Feature Issue contains a new feature or new component request label Jan 14, 2022
@mertsincan mertsincan added this to the 7.1.1 milestone Jan 14, 2022
@sbrauch
Copy link

sbrauch commented Sep 7, 2022

I think I'm having the same issue but only with my dropdown, no problem with .
As soon as I click on the dropdown to select a value, it scrolls back to the selection checkbox and autofocuses. (I'm combining rowEdit with selection. (I am also using Cell Edit when clicking on a button, but this doesn't seem to be the issue as far as I checked). By the way, it "does work" when the dropdown already has a value (otherwise it's null), but the page turns blank when clicking on the dropdown (screenshot 3).
Is there any update?

Capture d’écran 2022-09-07 à 10 44 52

Capture d’écran 2022-09-07 à 10 44 43

Capture d’écran 2022-09-07 à 10 53 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

3 participants