Dropdown placeholder text

Hello!

When I delete values from a multiselect dropdown I want to show a message on the placeholder to clarify you need to have a value in order to aply filters

I delete the values with a button like:

    else:
        # Second click: Clear the selection
        dropdown.props.value = None  
        self.parent.custom.selectAll = False  
        self.props.image.icon.path = "material/done_all"  

        # After resetting the value, update placeholder text
        dropdown.props.placeholder.text = "No hay ninguna sede seleccionada"

        dropdown.props.value = []

If I take out values manually the text appear,

If I do it with the button it doesn´t show any text:

I guess I need to trigger the internal logic of the dropdown placholder to do this.

Any ideas welcome.

Cheers.

I think the place holder only shows up when the props.value is null. The last line in the script sets it to [] not None (null).

2 Likes

Yeah, that´s it! thanks a lot @dkhayes117 !

    else:

        dropdown.props.value = system.util.jsonDecode("null")  
        self.parent.custom.selectAll = False  
        self.props.image.icon.path = "material/done_all"  
1 Like

You're in Jython. Shouldn't that be,

else:
    dropdown.props.value = None
    ...
3 Likes

Yes, with none it works also!

"none" won't work. "None" will.

1 Like