Canvas dropdownControl default value

I am using the dropdownControl to select which of our stages I want to see data on:

csv data="stage
prod
stg
int
test"
| dropdownControl valueColumn="stage" filterColumn="fields.stage"
| render 

Now I want to set a default value, so that users opening the Canvas for the first time would get a specific value selected. Is that possible?

I would like to combine this with the urlparam function so that I can link users to a specific stage, but still allow them to select a different one later on.

I just checked the Canvas Workpad JSON and see that this stored as part of the object:

{
	"id": "dropdown",
	"position": {
		"left": 1754.75,
		"top": 122.375,
		"width": 153,
		"height": 50,
		"angle": 0,
		"parent": null
	},
	"expression": "csv data=\"stage\nprod\nstg\nint\ntest\"\n| dropdownControl valueColumn=\"stage\" filterColumn=\"fields.stage\"\n| render \n  css=\".canvasRenderEl select {\n  color: #bbb;\n  border-color: #bbb;\n  background-color: #000;\n}\n\n.canvasRenderEl svg {\n  color: #bbb\n}\"",
	"filter": "exactly value=\"test\" column=\"fields.stage\""
}

So I guess this is something that is stored within the Canvas workpad, and cannot easily be overridden?

Good morning, Benny! Yeah, it doesn't look like the dropdownControl function allows for a default to be specified, at least at the moment.

I would recommend opening an enhancement request to add defaultValue as an arg to dropdownControl. That would get passed on to dropdown_filter as its value, (assuming it was was present in the collection.

Feel free to refer to this post in your enhancement request. Cheers!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.