Hello. From what I understand, you can use jQuery to add new "filter lines" in your form (using the append function, for example) and submit that data as string arrays for your action. In the action you go through the arrays with column names and values (maybe also type, such as CONTAINS, DOES NOT CONTAIN, etc.) and generates your query.
To generate new rows, there are a few ways:
- Create a new div; create the inner elements and insert them into the div; insert the div into the form.
- Add the div already with the inner elements by inserting direct HTML code (
$("#meuform").append("<div><select...")
).
- Create an action that returns a view with only one filter line, containing the select, input, button, and so on. Make a load and load this view via Ajax by inserting it into form.
- Create a "template" div containing the elements of the filter (select, input, etc), leave it with display: none and to insert a new line in the form, copy the contents of that div (using the html (), for example).
With these lines created in the form, you submit to your action and there it generates the query.