evoluteur / structured-filter

jQuery UI widget for structured queries like "Contacts where Firstname starts with A and Birthday before 1/1/2000 and State in (CA, NY, FL)"...
http://evoluteur.github.io/structured-filter/
MIT License
258 stars 61 forks source link

Restore filter from valUrl #30

Closed samcov closed 2 years ago

samcov commented 2 years ago

I get the filter url: let filterUrlFormat = $('#sonarioFilter').structFilter('valUrl');

Then I try to set the filter, but it fails to do anything: $('#sonarioFilter').structFilter('valUrl',"filters=1&field-0=Gender&operator-0=eq&value-0=male&label=Gender%20equals%20%22male%22%20");

Is there something I'm missing?

evoluteur commented 2 years ago

That is not the way I intended it to work. It is a good idea though. To set the filter value you must use "addCondition".

samcov commented 2 years ago

Wait, if you save the 'valUrl', can you then do the following?

$('#sonarioFilter').structFilter('addCondition',"filters=1&field-0=Gender&operator-0=eq&value-0=male&label=Gender%20equals%20%22male%22%20");

evoluteur commented 2 years ago

It is possible but I didn't do it. You will have parse the url and generate a JSON object to pass to the method.

samcov commented 2 years ago

Can do, thanks!

samcov commented 2 years ago

BTW, was there a reason you didn't do a "<=" and ">=" for numbers?

evoluteur commented 2 years ago

I wanted to keep the list of operator short. Maybe I should have added it.

samcov commented 2 years ago

No problem!

Excuse my bad manners, I forgot to mention that I just love what you've done here.

Thanks for the prompt responses!

evoluteur commented 2 years ago

Thank you. No worry. I enjoy getting feedback on my work. Unfortunately I do not have much time to spend on my side projects right now so I can't commit to new features. Also, I moved to React in my full time job so I'm slowly forgetting my jQuery...

samcov commented 2 years ago

No problem, I can work around all of my issues... Thanks!