DataTable Filters - Dynamically loading values on change

UI Components for Vue
Post Reply
chuckbeats
Posts: 5
Joined: 03 Apr 2020, 07:03

10 Dec 2021, 19:36

I've gone through the source code and honestly, I'm still a little confused on the filters. I've traced it through to see that the filterCallback() (that I'm still wrapping my head around a little), eventually emits a filters:update via the onFilterApply() in the DataTable component.

At any rate, I'm trying to figure out two items. First is elementary and I'm missing it somewhere:
On this page, https://primefaces.org/primevue/showcas ... ble/filter
I'm not seeing how the Agent filter is working for example. I'm assuming it's sort of happening automatically via the filters, but I can't seem to find the function that's firing to actually filter the data.

Secondly, and primarily, we need to filter via ajax/server side calls. Is there an example somewhere for this?

We have many columns that are filterable, but won't get used. Ideally, we would want to have the dataset for those filter options be fetched based on current filters when the filter is opened. So fire an endpoint when the filter is clicked or opened to populate the filter options.

Outside of that, we would at least want to re-calculate all the filter values when any of the filters change, but obviously getting those values via a server side call. Can anyone help point me in the right direction or is there an example online that I may be missing?

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

14 Dec 2021, 13:48

For Agent, column's filterField holds the which field will be filtered and filterModel holds the filtered/ will be filtered values.

https://primefaces.org/primevue/showcas ... table/lazy you could find a server-side example.

chuckbeats
Posts: 5
Joined: 03 Apr 2020, 07:03

23 Dec 2021, 09:13

Thank you very much. Some how I missed the lazy mode when it came to filtering.

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest