Log in

HCMC Journal

BBTI 2025-01-28 to 2025-01-31

to : Martin Holmes
Minutes: 295

Since this is a pro-d project, I’m taking advantage of something it needs to pilot some JS code for aligning interdependent checkbox collections in a search page. This is something that’s been requested before, and although it’s almost always going to be a project-specific set of requirements, I think it may be possible to create some generic code that would be easy to plug into other projects. In this case, the selection of cities/towns you can choose from should be dependent on the selection of counties you make. I have the basics working, but what remains is to integrate this functionality into the staticSearch mechanisms that restore a search from a URL.

On Wednesday, worked on optimizing the layout of search filters, and on a function to run when the staticSearch has completed a search, which could provide an automatically-constructed link to a collection page.

On Thursday, figured out a way to keep the checkboxes properly aligned using a MutationObserver as well as the change event, since the former triggers when JavaScript changes the @checked attribute, and the latter triggers when the user changes the checkbox state. Also added the new feature enabling small search result sets to be viewed automatically in the form of a collection. Tweaked some CSS, and released 2.0.6b. This work -- or more properly, the difficulty in doing it -- has prompted a feature request ticket on the staticSearch project suggesting that the StaticSearch object emit custom events whenever various things have happened.

On Friday, fixed a minor JS bug in the work yesterday, and published a new version.