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

Tabulator row selection does not persist when changing pages #4367

Closed
CrashLandonB opened this issue Jan 30, 2023 · 5 comments · Fixed by #5889
Closed

Tabulator row selection does not persist when changing pages #4367

CrashLandonB opened this issue Jan 30, 2023 · 5 comments · Fixed by #5889
Assignees
Labels
component: tabulator Related to the Tabulator widget type: enhancement Minor feature or improvement to an existing feature

Comments

@CrashLandonB
Copy link

MRE:

import panel
import pandas
import numpy

data = numpy.random.random((300,6))
df = pandas.DataFrame(data)
tab = panel.widgets.Tabulator(value=df, sizing_mode='fixed', disabled=True, pagination='remote', page_size=25,
                              selectable='checkbox', header_filters=True)
panel.serve(tab)

With the example above, if I select a few rows, change pages, select a few more rows, and return to the original page, I don’t see the rows selected any longer.

The MRE above seems to recreate the issue with 300 rows. I intend to use this on a data set with around 100,000 rows.

(FYI, relevant conversation and confirmation that others have seen the issue available here)

@philippjfr
Copy link
Member

Thanks @CrashLandonB. Agree that this may be nice however we intentionally did not implement this as relying on it seems somewhat error prone. Basically my concern here is that selections reset if you don't press Ctrl/Shift while selecting a new row and if you are on a different page you have zero visibility on whether you accidentally reset your selection. Very open to suggestions on improving the UX around selections though.

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Jan 30, 2023
@CrashLandonB
Copy link
Author

@philippjfr Interesting point about the Ctrl/Shift; I can see that could be error prone. With the settings above in the MRE, I was just using the checkbox method, so hadn't even thought that far ahead.

In my head, I was equating the selectable function to the idea of simply having another column in my DataFrame that I might call "Selected" and just toggle the value between True or False. Perhaps that might be my best option for my current task, requiring a little more deliberate and traceable action from the user.

But to your question, I'd say Ctrl/Shift is commonly-used in very-fleeting cases of item selection, and I agree that seems error prone. I suppose my main feedback then is that it seems counter-intuitive that the selections are not persisting. I'd lean more-towards letting them have "enough rope to hang themselves with". Perhaps a risk mitigation would be, when items are selected, an indicator of "total selected items" count would be show somewhere by default? (Excel kind of does this, for example)

I've also realized that even if I made my selections, I don't see a means to filter the table to "selected rows", right? I definitely want to do this, so my best approach might be to simply give the users that extra "selected" column, let them manually change that value, and then use the header filtering to let the user collapse it to selected rows.

@philippjfr
Copy link
Member

Very good good point, I had forgotten about the checkbox selection feature. That does change my perspective and means we should absolutely persist selections across pages.

On the filtering questions we can brainstorm separately. Certainly you could add your own toggle to temporarily switch out the data to display only selected data.

@CrashLandonB
Copy link
Author

Sounds good. I think I have an alternate approach with Tabulator to get the job done, but I'll certainly look forward to seeing the change if you proceed. Thanks!

@orangeSi
Copy link

orangeSi commented Feb 1, 2023

Sounds good. I think I have an alternate approach with Tabulator to get the job done, but I'll certainly look forward to seeing the change if you proceed. Thanks!

Could you share the alternate approach ? I just encounter the same question as you now~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabulator Related to the Tabulator widget type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
5 participants