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

How to save selection between pages? #217

Open
moabtools opened this issue May 21, 2019 · 6 comments
Open

How to save selection between pages? #217

moabtools opened this issue May 21, 2019 · 6 comments

Comments

@moabtools
Copy link

Online reproduce

First table on: https://www.njleonzhang.com/vue-data-tables/#/en-us/event

Expected Behavior

Selected rows do not deselectes when page changes

Current Behavior

Selection losts when page changed

Steps to Reproduce

  1. select some rows in table
  2. go to page 2
  3. return to page 1

Detailed Description

Simply select some rows in your first sample table, then go to page 2, then return to page 1 - voila! - previously selected rows are not selected now. How to save selection between pages?

@moabtools moabtools changed the title How to save selection between pages How to save selection between pages? May 21, 2019
@njleonzhang
Copy link
Owner

I think you need store the selected rows by yourself, and leverage el-table apis, such as toggleRowSelection, to implement.

@moabtools
Copy link
Author

Of course I can do it. But you know, any professional tables implemented this behaviour by default.

@njleonzhang
Copy link
Owner

currently, it is not supported. I will consider to implement.

@stale stale bot added the stale label Jul 5, 2019
@njleonzhang njleonzhang removed the stale label Jul 6, 2019
@stale stale bot added the stale label Aug 5, 2019
@stale stale bot closed this as completed Aug 19, 2019
@njleonzhang njleonzhang reopened this Aug 20, 2019
@stale stale bot removed the stale label Aug 20, 2019
@CMarzin
Copy link

CMarzin commented Nov 21, 2019

I have found a workaround for the moment, you can do this
this.$refs.periodDatatable.$children[0].toggleRowSelection(this.data[1])

Selected the first children of the data-table-server because its a wrapper around el-table from element ui, and with this code this.$refs.periodDatatable.$children[0] you can leverage every native function of the EL TABLE component.

It works but i don't know if its the best solution, the best solution would be to add this function in the datatables component directly !

Repository owner deleted a comment from stale bot Nov 21, 2019
Repository owner deleted a comment from stale bot Nov 21, 2019
@njleonzhang
Copy link
Owner

I have been really busy recently, I am afraid I can not implement this feature in short term. PR is welcomed. 😭

@CMarzin
Copy link

CMarzin commented Nov 21, 2019

It's ok no problem I will try to implement it myself and then I will a PR, thanks for your libs it has helped me quite a lot this year !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants