Hi @leekelleher
, @timgeyssens
,
I'm using 2 Contentment datalists in the back office Member profile, they work fine however is there a way to update the datasource of one of the dropdowns on the change event of the other?
I think if there is a was to create a hook into the on change I should be able to change the datasource from there.
@damiondaly
- thanks for the question! There isn't a hook/event on Contentment's dropdown list editor, but it's a good suggestion.
In answer to your question, there is a hidden (undocumented) feature in Contentment called "Cascading Dropdown List" - which I use for the Enum data source, to pick an assembly, then enum type.
It's currently available as a prevalue-editor, but I have plans to make it as a true property-editor in v2.1. (I don't have a schedule for upcoming releases - when I have time/energy really.)
Thanks, I'll take a look at that. I got round it for the moment by adding a js file into the package folder which pick up the change of the first dropdown, then gets the new data for the second dropdown.
That bit works, but now I can't see when the second dropdown is changed or the data is dirty so maybe your cascading one will be the way forward.
Thanks again
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @leekelleher , @timgeyssens ,
I'm using 2 Contentment datalists in the back office Member profile, they work fine however is there a way to update the datasource of one of the dropdowns on the change event of the other?
I think if there is a was to create a hook into the on change I should be able to change the datasource from there.
thanks
@damiondaly - thanks for the question! There isn't a hook/event on Contentment's dropdown list editor, but it's a good suggestion.
In answer to your question, there is a hidden (undocumented) feature in Contentment called "Cascading Dropdown List" - which I use for the Enum data source, to pick an assembly, then enum type.
It's currently available as a prevalue-editor, but I have plans to make it as a true property-editor in v2.1. (I don't have a schedule for upcoming releases - when I have time/energy really.)
For an example of how you could use it today - take a look at the config for the Enum data source picker, EnumDataListSource.cs#L41-L56, and the API controller, EnumDataListSourceApiController.cs.
Hope this helps?
Thanks, I'll take a look at that. I got round it for the moment by adding a js file into the package folder which pick up the change of the first dropdown, then gets the new data for the second dropdown.
That bit works, but now I can't see when the second dropdown is changed or the data is dirty so maybe your cascading one will be the way forward.
Thanks again