ufTable: pair with a search form?

Following up on this idea, I’m trying to build out a form to fine tune searches for users, more than just filtering by column.

Building out the webform is easy enough, and I’ve been able to get as far as submitting the parameters and having my sprunje return the results. However, I’m a bit stuck on how to display this data.

My initial idea was to try to leverage ufTable since it handles things like paginating the results to help with performance. However, as far as I can tell, it works with a GET-type API endpoint but not a POST one. (I’m submitting the data from my form via POST.)

A couple of questions:

  1. Is there a convenient way other than ufTable to show an arbitrarily large number of results?
  2. Has anyone used a ufTable with a POST-type API endpoint?

I’ve got a very primitive keyword search working by embedding the submitted term and then initializing the ufTable whole-table search field with that value, but this won’t work for the more complex queries I want to support.

I can provide code samples if that helps but it’s a lotttt of code (routes, controllers, templates, js, custom sprunje and more) and this seems more like a concept-level predicament.

ufTable uses tablesorter for sorting/pagination. I think there are other ways to handle this without using the query string. The documentation would be a good place to start.

Keep in mind if you use POST you will not be able to bookmark searches.

It may be more work than what you’re willing to take on, but I think it would be cool to see common search filters supported natively in ufTable. For example, the search expressions listed here. It would need to be added server-side, as that is where UserFrosting handles it.

Ping @Malou @SiliconSoldier - maybe they have already considered about how to implement this feature.

I’m not sure how can this done… as @Amos_Folz pointed out, we uses Tablesorter for the pagination stuff. Even if you could force the table to display your specific result, the pagination won’t work after. Most of the loading api stuff is in Tablesorter code I believe.

I think it could be possible however for your form to control the main table filter bar…? We already have a uf-table method to refresh the result.

Another solution would be to use your own custom table. Nobody said we have to use uf-table everywhere :stuck_out_tongue:

Thank you both for the suggestions! I’ve made a few attempts at customizing the tablesorter pager widget (based loosely off of this StackOverflow thread), and have had luck getting the search terms submitted to the database and back to the pager_ajaxProcessing function. The issue now seems to be that the template is processed before the ajax search occurs, so the table is rendered without the data. Is there a way to trigger a rerendering of the ufTable from the JS callback?

I’ve decided that I don’t need to display the results in a table necessarily so I’m electing to use a different plugin to help paginate my results. This is the one I’m using: https://pagination.js.org/docs/index.html

Thanks for the ideas though!