Limit allowed nodes using entityResource? Like in the MNTP
Hi guys
I'm currently working on a property editor where I would like to setup some filtering like we know it from the Multinode treepicker (MNTP).
I'm using the entityResource and passing a query to it, which works just fine. However I would like to improve it so that I'm only allowed to select content nodes, which have a specific alias - Just like when we setup allowed types on the MNTP.
I have tried looking in the Umbraco source code but can't seem to find any clues - I'm not sure that this is currently even possible?
One weird thing though is that the unselectable items are not being greyed down like when using the MNTP - But they're just not selectable. Must file a bug report I think.
Naaa, it's a bit odd that it's not acting the same way as when one is using the MNTP. But the important thing is that the editors can't make any mistake.
Limit allowed nodes using entityResource? Like in the MNTP
Hi guys
I'm currently working on a property editor where I would like to setup some filtering like we know it from the Multinode treepicker (MNTP).
I'm using the entityResource and passing a query to it, which works just fine. However I would like to improve it so that I'm only allowed to select content nodes, which have a specific alias - Just like when we setup allowed types on the MNTP.
I have tried looking in the Umbraco source code but can't seem to find any clues - I'm not sure that this is currently even possible?
My current code looks like below
As I mentioned it works but I would like to tweak it so I'm only allowed to pick certain document types (If possible).
Looking forward to hear any tips/suggestions :)
Cheers, Jan
Hi Jan
Looking at the source, the ContentPicker, calls the TreePicker, passing through it's options:
and if you have a look at the TreePicker:
https://github.com/umbraco/Umbraco-CMS/blob/75c2b07ad3a093b5b65b6ebd45697687c062f62a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js
it has a 'filter' option that will take an angular function or object, or json, or I think a comma delimited whitelist of doctypes:
so if you set
as one of the options you pass to the contentPicker and cross your fingers.
regards
Marc
Thank you Marc - You're spot on! :) - Remind me that I owe you a beer at #CG16 - I assume you're going?
I had a notion that it would be easy but just could not find that missing part - Would be nice if it was mentioned in the documentation at https://umbraco.github.io/Belle/#/api/umbraco.services.dialogService
One weird thing though is that the unselectable items are not being greyed down like when using the MNTP - But they're just not selectable. Must file a bug report I think.
Cheers, Jan
I was tempted to start the reply with
Hi Jan, welcome to the forum...
but glad it worked; not sure about the greying out.
Why would that be? You calling me a n00b? :-)
Afterall I'm only human.
Naaa, it's a bit odd that it's not acting the same way as when one is using the MNTP. But the important thing is that the editors can't make any mistake.
Cheers, Jan
is working on a reply...