Manipulating the Selected Items in a Data List #416
-
One of the common uses I've used your (amazing!) Data List editor for is to allow clients to associated categories with a page. For instance, we have a Location page in Umbraco (called, say, "USA"), but that location page needs to associated a list of Cities that belong in that location from a list (retrieved from an API). We then use this for further API calls to pull in data to the page based on that list of selected cities. The problem is it requires the Editor to go in and manually select all the Cities (or whatever) that are associated with that page - sometimes from a pretty long list. This can be quite tedious, especially if there are a lot of pages to do this on. So I've been looking at using AI (yes, that bandwagon!) to help with this. I've got a good prompt where I can tell Chat GPT "here's the name of the Country, what cities from this list are associated with it" and it comes back with the list. It works for many other associations, too, like "give me all the items that are in the IT category". I'd like to somehow hook this into Contentment. Ideally when the picker opens there'd be a "use suggestions" button which could then call an API endpoint and pass in the data list values and some other value for context to be used to generate the list of suggestions which would then pre-select those suggestions in the interface. I'd possibly be up for making a PR to do something like this, but obviously it could be a lot of work and probably has a very narrow audience and I'm not sure if your focus is now on the v14 version anyway? Another option I was thinking was to somehow have another custom property editor that basically consists of a button that when pressed gets the suggestions and then updates the Contentment list of selected items. I'm just not sure if that is possible. I've messed around with Is this just fanciful? Is there any way for one property editor to change the value of another client side? If you have no idea, then fine, I'm not expecting you to research this. I was just wondering whether in your vast experience you had come across this or thought it might be possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@DanDiplo Hey Dan, apologies for taking a while to reply back to you on this one. My head has been so deep in Bellissima-land that I can't quite recall how one property-editor can edit the value of another property-editor in AngularJS... like you say there's A potential solution for Contentment Data List could be to introduce a custom event on the So in Data List, we could add something like this...
and in your custom property-editor, you'd have something like...
Thoughts? I'm open to adding this event for Contentment v5.x, if you think it's a workable approach to the given problem. |
Beta Was this translation helpful? Give feedback.
-
Hey, no worries @leekelleher - I know you are a busy man! As you say, there doesn't seem to be a natural simple way to do this in Umbraco, but using the events service like you mention seems like a great way to achieve this. So, yeah, it does sound like it could be a workable solution 👍 |
Beta Was this translation helpful? Give feedback.
@DanDiplo Hey Dan, apologies for taking a while to reply back to you on this one.
My head has been so deep in Bellissima-land that I can't quite recall how one property-editor can edit the value of another property-editor in AngularJS... like you say there's
editorState
and traversing up the$parent
structure until you hit the right spot and set themodel.value
, then as you say it's flakey. To note, this is much much simpler to achieve in Bellissima (there's a concept of property datasets, which can monitor/set each others values).A potential solution for Contentment Data List could be to introduce a custom event on the
eventsService
that could trigger Data List to update it's values. 🤔 …