rubanraj54 / vue-bootstrap4-table

Advanced table based on Vue 2 and Bootstrap 4 ⚡️
MIT License
220 stars 58 forks source link

client side filtration and sorting in server mode #11

Closed daoudzd closed 5 years ago

daoudzd commented 5 years ago

hello, thank you for the great component i love it, i am using it with server mode enabled and i handled the pagination, i wonder if you can add an option to activate built in filtration and sorting in server mode

Chris-Pratt-Clystnet commented 5 years ago

To do this follow the documentation on sorting and filtering and then in the backend when the request comes in you will have a "filters" and "sort" entry on the request.

Both of these will come in as an array with json encoded data in them for each entry.

rubanraj54 commented 5 years ago

Hi @daoudzd ,

I am thinking how this will work in a real scenario.

If you use the table in server mode, vue table will have only the data for the current page. So in this case, I don't prefer to do sorting/filtration for the local data. That's how all other table components work.

I know it is achievable, but I'm not sure about how many people use this feature.

So, I would suggest that whenever there is change in sorting/filtration, you listen for the "on-change-query" event as specified in this link https://rubanraj54.gitbook.io/vue-bootstrap4-table/server-mode#example and then send the query params to the server side. Once you have your query parameters in the server, do filteration/sorting in the server itself & return the response to the table.

If you have any other doubts, don't hesitate to comment back.

@Chris-Pratt-Clystnet Thanks for your support.

Cheers, Ruby.

daoudzd commented 5 years ago

hello thank you @rubanraj54 and @Chris-Pratt-Clystnet for the explanations i managed to sort and filter data in the backend (spring boot application)

rubanraj54 commented 5 years ago

Good to hear that.

I will close this issue.

Cheers, Ruby.