• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

dropdown values are not sorted when element is a list of multiple quoted numbers

rpc

New Member
I have an element that contains a value in the form:
["208", "220", "230", "240", "380", "400", "416", "440", "460", "480", "500", "550", "575", "600"]
Each entry can contain different sequences of numbers. The dropdown nicely displays the unique set of values that are used in this field across all entries, but they are not in sorted order. How can I get them in numerical order?
 
In the element - list view settings - filters, I specified a filter type of dropdown and order by of label.
Where is the suboptions that I am dragging & dropping?
What is not in numerical order is the list of values displayed in the dropdown for the specific field. See attached.
 
The dropdown.png in my previous post reflects what is seen when looking at the list filter, so no, it is not ordered correctly in that view.

Where is that form's dropdown you reference? I don't see that "Renders Drop down / multiple select box" under Forms anywhere.
 
It's in the element settings if it's a dropdown element, is it a dropdown?
I have an element that contains a value in the form:
["208", "220", "230", "240", "380", "400", "416", "440", "460", "480", "500", "550", "575", "600"]
I'm not sure about your setup: is this what you are seeing directly in the database?
 
Yes, the database field contains quoted numbers, separated by commas, wrapped by square brackets:
["208", "220", "230", "240", "380", "400", "416", "440", "460", "480", "500", "550", "575", "600"]
Attached are the Fabrik configuration screens.
 
Each database entry could contain a different list of values in that field, for example, here are four different entries:
["208", "220", "230", "240", "380", "400", "416", "440", "460", "480", "500", "550", "575", "600"]
["230", "460", "550", "575", "600"]
["550", "575", "600"]
["380"]
 
So you have a simple field element holding JSON strings.
I assume it's only by chance that this is interpreted as "repeat data" and shown so nicely formatted.
A field element with text format is usually just a string.

@cheesegrits ?
 
Is there another way to store this in the database or another element type definition, to make this work?
Or is there a way I can define a separate sorted list of values used only for the dropdown?
 
Is this a fixed number of values?
How are they filled in (I assume the user is not typing such strings)?
What do you need?

It may be possible to use a multiselect dropdown element
or a multiselect (or rendered as checkbox) dbjoin element (which is more flexible).

Is this "live" data which must be converted if you are changing e.g. the element type?
Or are you just testing?
 
Yes, the total number of unique numbers would be fixed, but each database entry can have a variable number of values as shown in my previous post.
I am placing these values directly into the database, users of this data do not do any input/modify of this field. This field is not displayed to the user, it is only used for this filter behavior.
This is not live data.

The current format of the data allows me to filter on one specific value (via the dropdown, exact match=no), and it returns all entries that contain that one value.
I need that dropdown (dropdown.png attached to the previous post) to list all these values in numerical order.
 
It you want to have such JSON strings stored in the DB you can use a checkbox element or a dropdown element (with multiselections enabled).
It's storing the values, you can set the labels as you like. The labels will be shown in the filter dropdown.
 
Yes, the dropdown now lists all the values in numerical order, but the "All" option is no longer listed in the dropdown. Is there a way to add that back in?
 
Ok, I figured out how to add the "All" option back into the dropdown, I needed to add each value into the Sub options list (then "All" magically appeared at the top).
How do I get it to use the sub option list sequence in the dropdown?
I've tried different options, but I couldn't get it to conform to the sub option sequence.
See the attached sub option list sequence and dropdown sequence.
 
I had tried "None", but now I also modified "Filter data" to "Show all", and that worked. Thanks!
Is there any other way to get the "All" value shown in the dropdown without having to fill in all the values as sub options?
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top