All Questions


How do you guys do something like that?

Hello. I’m seeking advice on how to approach filters in my apps. Currently, I have table component, where user can add filters based on existing columns. User can have multiple filters on same column. For example price can be higher than and also lower than in the same time (2 filters). Now that harder part. I’m trying to generate query params for these filters, where there will be id, operator and value for each filter. I’m using JavaScript and dont know, how to put array of filters in query params, which I can then parse on backend server and return user filtered items in table. I’m using GET to get items to table, that’s why I want to use query params. But I was thinking about using POST and put filters as body request. What do you think?

author Dobroslav Radosavljevič

7 Answers

I found 1 solutions. Parse all filters in array as JSON and then send that JSON as query param to server. Is it good approach?

writen by Dobroslav Radosavljevič

Not an expert on this, but do you know:

writen by Justyna Ilczuk - very popular 18k+ starts on github

writen by Justyna Ilczuk

I’m not looking for Table solution (I’m using React Table), but I’m looking for solution how to parse array correctly and put it as query params in GET request to backend.

writen by Dobroslav Radosavljevič

Wolfgang Gassler , <@U02NH9BN5FY>, Julia Álvarez any ideas?

writen by Tiago Ferreira

Dobroslav Radosavljevič I’m a big fan of sending filters as JSON in a POST request for complex filters like this. That’s what I’m doing right now in the search engine I’ve built. Also did this in the past for complex adtech dashboards and filters on a dating site used by millions of people.

writen by Skylar Givens

Yep go with JSON + POST here. It’s well within RESTful parameters, especially for more complex or longer filters. If it will only be a few params you could still use GET. Depending on your framework either using name=val1&amp;name=val2 or name[]=val1&amp;name=val2 can work for arrays in the query param as well.

writen by Benedikt

Do you want to ask a question?

Related Questions