I’m trying to extend paged query to allow user to filter on multiple columns in table.
I extended paged query and I’m looking for the hjson of the Wappler paged query to stick as much as possible as the original, but I can’t find if it’s possible to have the query editor as the original database query modules.
EDIT: For the dropdown of database connections I don’t know if we can have that too in custom modules?
Maybe I’ve missed some option but I don’t currently see how I can in a paged query filter from dynamic column with dynamic “search value”.
Example for url would be:
/api/request?sort=a&dir=asc&filter=b|testORa|3
And my request would generate a where clause like:
SELECT ... WHERE b ~'test' OR a > 3
Something like that (don’t have the final design if you have suggestion The idea is to allow user to click on a column and filter by dropdown when column type is an enum, if the type is date allow them to select a range of months or year, etc)
Well yes but I want the name of the column and the number of filter be dynamic, coming from the request and then I do something like that (from last example):
You can just add all columns you want to filter and add a conditional per column when to activate the filter. So you will have multiple conditional activated filters like this.
The conditional option in Query Builder is a great feature; QB would far less powerful/useful without it. Eg you can create pages with mulltiple search options with it.
As far as I know, the only way to create a completely dynamic query it to use a custom query to execute a stored procedure - eg you could store any query in a variable and run that.
If you need full control over the query I don't see another way but to use a custom module. My use case was very specific though as I wanted to pass the name of the table dynamically which is currently not possible with Wappler. Knex does a good job at making sure there is no SQL injection so I used knex for this.
Do wappler use knex? I mean I’ve never wondered but now you say that I’m wondering if Wappler handle for me sql injection when I’m using Wappler modules?