Saving values for Text List

I would like to be able to set some ‘preset’ values for the widget. But these values I add don’t look like they get saved? Is there another way to do this? @Pete_Hartnett

Hey @mellerbeck -

Those props in the custom widget UI are primarily for testing your widget without needing to constantly save changes, or use an app. Default values is pretty straightforward. In this case I just declared a default variable, and if my prop is null or length zero, use my default value:

To support Null - values two pipes will pass the first non-null value, so if you dont pass anything to this prop, we will pass def_value

rerender(values||def_val);

To support empty lists - we check the length of the text list and if it is zero, use the default value:

if(values.length ==0){
        values = def_val;
    }

Let me know if this doesn’t do what you need-
Pete
customWidget-Default Value (1).json (2.3 KB)

Cool, thanks for the example!

What I’m looking for is say a drop down that I can configure for the user of the widget, like the Display Style of the check box

image

1 Like