I was going to see if there is some approach for this, I looked at the example for the users group admin portal and see how they were doing it there with cards and such but anyone know of a way I might can take the genes section here which will populate from a db list of morphs available and allow people to select multiple entries that would go into the json db object?
I’ve found the posts where people have done this with repeating panels but wasn’t sure if I had a way to accomplish this with a dropdown or if anyone had suggestions, its really the only thing that could potentially have up to 6 selections, Example - Super Enchi Pastel Banana Ghost Harlequin (So this could have 6 different morph selections)
Last I checked, a drop-down can select at most one value at a time. Likewise for a radio-button-group. But you could use a series of check-boxes. Each box can be [un]checked independently of every other box.
hrm my only issue here is there over over 100 different morphs potentially they might need to pick from, this is what I’m trying to decide the right way to approach… I don’t know the right answer myself yet either.
The other site that I’ve been using temporarily just has a open text field where you type multiple values in, I guess I could just have people do that and create it into a list or something cause I want each morph seperately logged for some future plans in the app.
Is there any structure to these settings, e.g., 6 separate categories of settings? Settings that are mutually exclusive? If so, then maybe you can divide the list into usable subsets, and treat each one separately.
The only thing really with them is a snake could have up to 6 different morphs but not really any specific tie or relation to each it could have 1 or 2 or 3, etc all the way up to 6 different morphs.
Then when you combine some of these morphs they have “common names” so like a spinnerblast is a Pastel Pinstripe Spider, so I also will have a dropdown menu of these common names they can pick but at the same time I’d like to also include the options for them to pick the morphs instead of having to type each out in a comma seperated text box, etc.
You may want to record something more durable than the position number. What happens when you decide to insert an item? Or reorder the list (to make some groupings clearer)? Positions are not necessarily stable. But names are.
Have to work on the formatting but yea I think this will work, just have a Morph 1 Please Select, etc for each one then starting with Morph 2 the 2nd option in the list is none so that way they can just select that.
In my code if I see a morph set to none just won’t include that in my json payload that I eventually send to the table row.
Let me know if you see any issues with this thought process.
If you don’t want them all on the page all the time, you could create an ‘add’ button. You could instantiate a dropdown and put it into a container when the button is clicked:
def button_1_click(self, **event_args):
"""This method is called when the button is clicked"""
genes_dropdown = DropDown(
# Instantiate the dropdown as appropriate.
)
self.flow_panel_1.add_component(genes_dropdown)
I also thought about having a dropdown of all genes with a add button which just puts them into a text box below maybe or something of each morph selected and use these values when they add the snake record
Thoughts? The only issue I forsee is if they go in the text box to remove an entry they need to make sure the , gets removed or else I would need to check for that maybe in the code and just strip it if I find a entry with a , in the list.
On the combo change event you could add content instead of requiring the add button.
Also, you could add Links to a container, that way you could click them to remove them. You could then iterate through all the components of that container to get each gene.
Yea I was thinking the same thing, I keep finding myself building something then adding ontop of that lol. I like the idea of them just having links to remove them maybe instead of them being in a text box I could just do label texts with links beside them to delete them I guess.
So I figured out how to get them to show on the screen but when I click them it doesn’t remove them:
def morph_drop_change(self, **event_args):
"""This method is called when an item is selected"""
selected_morph = self.morph_drop.selected_value
morph = Link(text=selected_morph)
morph.set_event_handler('click', morph.remove_from_parent())
self.morph_card.add_component(morph)