bootstrap-table icon indicating copy to clipboard operation
bootstrap-table copied to clipboard

[cookie] Cookie extension not resetting selected page when searching

Open marceloverdijk opened this issue 1 year ago • 2 comments

Bootstraptable version(s) affected

1.21.0

Description

When using the cookie extension to remember table state, when searching the current page is not reset to the fist page.

Steps to reproduce:

  • https://live.bootstrap-table.com/code/marceloverdijk/12863
  • Go to page 2
  • Search for value 1
  • Expected result: Page 1 to be shown automatically
  • Actual result: Page 2 still active

Example(s)

https://live.bootstrap-table.com/code/marceloverdijk/12863

Possible Solutions

No response

Additional Context

No response

marceloverdijk avatar Sep 18 '22 07:09 marceloverdijk

I guess we don't change the page because if you remove the search you are back to the page you are started on. But for me it would be fine to reset the page.

It's similar to #6402. @wenzhixin @djhvscf What do you think ?

UtechtDustin avatar Sep 18 '22 10:09 UtechtDustin

From an UI perspective I think resetting the page to 1 makes sense. Even when just developing I find myself many times navigating the table (e.g. to page 3), then searching (or adapting search) and then not seeing the expected result directly. Just because I'm still on page 3 😬

marceloverdijk avatar Sep 18 '22 11:09 marceloverdijk

The example is not working for me at all. But I think we shouldn't reset the page.

djhvscf avatar Sep 22 '22 21:09 djhvscf

Hi Dennis ,

What is the problem you are noticing with the example? For me it works 🤷‍♂️

About resetting the page. What is your reasoning to not reset it to page 1 after searching?

Note , without cookie extension the page is reset to page 1 when searching, so why should this not happen when using cookie extension? (I'm missing the use case?)

It is now annoying when eg searching for "Mi" and you don't see expected result on page 1 . You go to page 2 and think "o still to many result and you adapt search to "Mic". Because page not reset to page 1 (only when using cookie) you miss the result from page 1. Same with Google or many other search , after adapting search you normally want to check again from the beginning , not on the page you were before.

marceloverdijk avatar Sep 22 '22 22:09 marceloverdijk

But if you think it's better to introduce a config option for this , that would be fine for me to (and I can update related PRs). Any name suggestion for such a config option ?

marceloverdijk avatar Sep 23 '22 05:09 marceloverdijk

@djhvscf The example also works fine for me. Could you please also explain why we should not reset the page ?

UtechtDustin avatar Sep 23 '22 07:09 UtechtDustin

Hi @djhvscf , are you still having problems with the example?

marceloverdijk avatar Oct 07 '22 06:10 marceloverdijk

@wenzhixin what do you think about this ?

UtechtDustin avatar Dec 30 '22 22:12 UtechtDustin