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

[Feature] side pagination = server cause filter-control does not work

Open zachary opened this issue 3 years ago • 14 comments

Bootstraptable version(s) affected

1.19.1

Description

if set bootstrap-table sidepagination="server", the bootstrap-table-filter-control features will not work.

Example(s)

No response

Possible Solutions

No response

Additional Context

No response

zachary avatar Dec 10 '21 17:12 zachary

Please provide an Online Example to show your problem, thanks!

djhvscf avatar Dec 12 '21 08:12 djhvscf

this option sends you a filter parameter to the server make sure you are using that in your query, if so please provide an example about your exact issue or provide screenshots about the problem

Nao-30 avatar Dec 20 '21 18:12 Nao-30

I have an example for what I think is happening:

https://live.bootstrap-table.com/code/j1v37u2k3y/10446

The expected behavior once we click the load button is that the filterBy would load the "Item 3" item.

Once you remove the data-side-pagination="server" attribute and push the button the filter works as expected.

j1v37u2k3y avatar Feb 08 '22 06:02 j1v37u2k3y

@Nao-30 any status on this issue I think the example provided shows exactly what's happening. If not please help me understand if there is another issue or setting to make it work.

Thanks

tnory56 avatar Mar 03 '22 01:03 tnory56

@djhvscf right I agree what else needs to be provided? Do we need to setup something else?

j1v37u2k3y avatar Mar 03 '22 13:03 j1v37u2k3y

Looks like this is already fixed in develop branch. https://live.bootstrap-table.com/code/djhvscf/10686

We need a new release @wenzhixin

djhvscf avatar Mar 03 '22 15:03 djhvscf

If you hit the load button on the development version it does not filter for "Item 3". So I would it is still not fixed right?

tnory56 avatar Mar 03 '22 23:03 tnory56

I hit the load button and the data is still filtered

djhvscf avatar Mar 04 '22 07:03 djhvscf

@djhvscf The button is defined incorrectly it should be "filter". The code that is not working correctly is this:

$(function() {
    $button.click(function () {
      $table.bootstrapTable('filterBy', {name:['Item 3']})
    })
  })

I have fixed the code to replace the "load" with "filter"...

With data-side-pagination="server" enabled: https://live.bootstrap-table.com/code/j1v37u2k3y/10695

Just to be clear the filterBy method should filter by that attribute when that button is pressed:

With data-side-pagination="server" removed: https://live.bootstrap-table.com/code/j1v37u2k3y/10696

j1v37u2k3y avatar Mar 04 '22 14:03 j1v37u2k3y

Is there any more status on this? Or timeframe when this might be fixed?

tnory56 avatar Apr 01 '22 15:04 tnory56

@djhvscf I am curious as well what the status is of this issue. Thanks!

j1v37u2k3y avatar Apr 05 '22 17:04 j1v37u2k3y

Checking to see if any changes on this issue. @djhvscf

tnory56 avatar Jul 27 '22 13:07 tnory56

I don't really think, no i'm pretty sure that's for the "filterBy" issue described above, is NOT actually an issue, since it wasn't made for that. now that i realized, it is not a part of the extensions. it's one of the methods tho. and as described in the docs it can be used only on client side, that's why clearly it doesn't work when data-side-pagination="server" is enabled;

image

Nao-30 avatar Jul 31 '22 19:07 Nao-30

@Nao-30 You're right, this is not a bug. Currently it works as designed, as you already said it's also documentated. In the source code in the internal onSearch method we don't do anything if it is server-sided: https://github.com/wenzhixin/bootstrap-table/blob/develop/src/bootstrap-table.js#L961

But i agree we should improve that function and pass the parameter to the ajax call, which means the server could filter and return the correct data.

UtechtDustin avatar Jul 31 '22 19:07 UtechtDustin