This is something I wrote a while ago but I just had to revisit it as part of an 8.2 upgrade so figure I could share it at the same time.
When it was first written SLX did not have filters yet and the customers had a need for a “quick search” that would let them refine a group’s result without having to copy that group and edit the conditions. Nowadays this functionality is provided by filters but sometimes you just need a search box rather than having to drill down… think a phone number search, for example. So I created a little tasklet that would do just that:
What the tasklet does when the user click search is:
- Copy the conditions on the group the user is currently on (or their default lookup group if they uncheck “Within Current Group”)
- Create a new “Quick Search” group with those conditions + the ones they have selected in the tasklet
- Switch the user to that group
Most of the code is manipulation of the group’s XML representation so it’s not super interesting but it did take a little while to figure out. You can find it on github.
The widget is neat and very handy but I don’t like that it creates a fake group for its purpose. I also wrote another version that leverages the lookup code to create a custom lookup dialog – it looks a bit neater (and does not require the auxiliary group) but is not able to do a search based on the current group so it’s not quite as useful. When I first wrote the code I tried to get it integrated with the filters mechanism instead but could not find a way! Would love to know if someone has figured out how to make completely custom filters or somehow hook into the filter’s API to slip custom conditions.