lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

In form filter make values dynamic

Open arno974 opened this issue 8 months ago • 6 comments

In Lizmap, it is possible to create a filtering form to filter a layer based on the value of a field. When multiple filtering parameters are available, it would be useful to update the proposed values of the others parameters based on the values entered by the user.

For example, imagine a form with a dropdown list for EPCI and another dropdown list for cities. Currently, if I select an EPCI, all cities are listed, even those that do not belong to the selected EPCI. Would it be possible to make the proposed values dynamic by filtering them based on the user's filter selection(s)?

arno974 avatar Mar 26 '25 06:03 arno974

This would indeed be interesting, and would mimic the JS script https://github.com/3liz/lizmap-javascript-scripts/tree/master/library/tools/smartfilter

This would require to rewrite the Lizmap form filter. Note that some work has recently been done for the autocompleted fields: https://github.com/3liz/lizmap-web-client/pull/5045

mdouchin avatar Mar 26 '25 07:03 mdouchin

A demo of the script is available here

Gustry avatar Mar 26 '25 07:03 Gustry

Hello, it would indeed be interesting if the second criteria were updated based on the first filter criterion. I also encounter the same constraint.

MirBang avatar Apr 17 '25 06:04 MirBang

related to multiple filters for the same layer but not combine them https://github.com/3liz/lizmap-web-client/issues/5366

josemvm avatar Apr 17 '25 06:04 josemvm

We also think this would be great. It requires a major rewrite of the filter tool. At present, the only "cascadable" filter fields are the "text" ones with autocompletion, since recent POR: https://github.com/3liz/lizmap-web-client/pull/5045

mdouchin avatar Apr 17 '25 07:04 mdouchin

Une démo du script est disponible ici

I watched the demo, and that's exactly what I want to do; but I've never used javascript with lizmap, I have a question, where do I drop the JS file? and do I also have to change the html structure? I would really like to have as much information as possible regarding the insertion of a js file. also on this demo there is a message when entering the application and then you can click on a button to remove it I also wonder how to do that. Thank you in advance for your time and feedback

MirBang avatar Apr 17 '25 07:04 MirBang