I’m looking for a way to dynamically list resources depending on the selection of one or multiple tags assigned to them with tagger. I would like it to be automatic, meaning without the need to press an “Apply Filter” button or similar. Basically a pdoResources call on a page with a dynamic &where property depending on the selection, is what I need.
I’ve already looked through a lot of older threads and other posts, but couldn’t find a fitting solution to my case. I found the extra mSearch2 which looks like it’s doing what I need, but I’m a little hesistant due to the translated docs and as I don’t need an actual Search field, this might be more than I need.
Unfortunately it doesn’t, but still a very interesting read, thanks!
That did it! I know that I looked at that before, not sure why it didn’t click for me then…
Now the basic functionality is there, but I would definitely prefer only the resource call to be updated when a checkbox is checked (instead of reloading the whole page like how it’s working atm). I’ve been looking into how to implement an AJAX solution here, but if I understand correctly a regular AJAX call doesn’t work with MODX? I found an old thread with a rough explanation, I don’t really know where to start on this though.
I’m aware that my script would need more adjustments for this functionality, also location.search wouldn’t work as it causes a full refresh if I’m not mistaken. Maybe history.pushState is a good option then?
That creates some overhead, because you are also loading all the rest of your page that you already have. So you could create a new resource that only serves as an ‘ajax endpoint’, where you have a blank template and only a call to pdoResources to just return the html of the filter results and not a whole webpage.
I’m not familiar with pdoPage but looking at the documentation, there seems to be a lot of possibilities.
The section Example call with form filtering seems promising and if that doesn’t work, then maybe this section where you have to program more yourself though.