I am trying to do two things which are going slowly. The first is to have a double sided range slider to specify a high and low value over a range. The other is to set possible values on this slider from existing entries related to unique existing values in the columns of a database. The purpose is for filtering matching rows in a table.
The desired behavior is to have on a horizontal slider bar two draggable nodes. The left indicates the lowest value, the right indicates the highest value. A user can drag the nodes to adjust the selected range. Either node will only rest on a value which is present in the related column. Values are not in even steps, but on a linear scale. Below the slider bar and nodes, there would be a textbox on the left and one on the right, with the left indicating the current left node value and likewise for the right one.
From what I can read about Forms in Django, this pattern of sending in rows from a table into a Form is atypical and not particularly easy. But what do I know, I’m too new to this specific thing.
There are two separate and distinct elements here - related, but independent.
First is the UI widget in the browser. What you describe is not a standard HTML widget, which means you need to either find or create an implementation of this in JavaScript. Since this work is being done in the browser, Django cannot directly handle it. (My interpretation of your description is that the HTML range element would not work for you in this situation.)
Once you’ve identified the widget you would like to use, then you can figure out how to supply the necessary data from Django to that widget. For this step, you may find the Django json_script filter to be helpful.
Thanks! I’ve been reading your contributions for a bit on this forum.
This is correct. The closest I’ve found is Horizontal Multi-Thumb Slider Example | APG | WAI | W3C so it isn’t entirely unheard of, just not common enough to add to the standard. My understanding is that I’ll have to make a new widget. The json_script filter looks like it would be useful. I just have to figure out how to piece everything together.