Hi, I have created a custom data type that allows editors to configure styling options for the Document Type it is a property on. This Document Type is then being used within a Nested Content item. This is all working correctly,
ie - a content editor adds content via the backoffice they can choose from a list of styling options. The chosen option are then applied to the front end view.
This data type is being used on a number of Document Types, what i would like to do is set the default selected options based on the Document Type (not the pages document type, the nested contents document type).
My JS contoller for the data type fires correctly (ie when the nested content is opened) however i cant figure out how to get the related doc types information ... any ideas ?
Hi Rune and thanks for your help .... i could have sworn i checked that ... anyway thankyou. I have managed to loop through all the properties and can create an object array of my custom data type 'stylingOptions' - perfect.
Now i am trying to work out which one is currently in view, the property has a key but this doesn't match anything in the $scope for the data type. Any ideas
Hope that makes sense any any help in pointing me in the right direction is appreciated :)
Thanks
PS is there any difference between editorState.getCurrent() and editorState.current
So right now using the editorState i have created an array of each instance of stylingOptions (this is the propertyAlias). This is on a number of nested content items, and can actually be nested within nested content. So the list for example contains 12 entries relating to stylingOptions.
The array is made up of an object which has the following fields 'stylingOptions', 'ncContentTypeAlias' and 'key'.
Now i go and open one of the Nested Content items, my JS runs so i have my array of all stylingOptions instances, i want to find out what has just been opened so i can retrieve the ncContentTypeAlias from my array.
Hope that makes more sense. and thanks for the quick response
Ouch, that is a tricky one... I don't see any obvious solution to that. Show/hide NC items is all handled in the NC edit view by checking realCurrentNode. It exists on a parent scope somewhere but I don't know of a good way to get that :/
Nested content
Hi, I have created a custom data type that allows editors to configure styling options for the Document Type it is a property on. This Document Type is then being used within a Nested Content item. This is all working correctly, ie - a content editor adds content via the backoffice they can choose from a list of styling options. The chosen option are then applied to the front end view. This data type is being used on a number of Document Types, what i would like to do is set the default selected options based on the Document Type (not the pages document type, the nested contents document type).
My JS contoller for the data type fires correctly (ie when the nested content is opened) however i cant figure out how to get the related doc types information ... any ideas ?
Hi Asif
You should be able to get what you want with https://our.umbraco.org/apidocs/ui/#/api/umbraco.services.editorState
Inject into your controller and try doing
console.log(editorState.getCurrent());
to see all the glorious info available :)/Rune
Hi Rune and thanks for your help .... i could have sworn i checked that ... anyway thankyou. I have managed to loop through all the properties and can create an object array of my custom data type 'stylingOptions' - perfect.
Now i am trying to work out which one is currently in view, the property has a key but this doesn't match anything in the $scope for the data type. Any ideas
Hope that makes sense any any help in pointing me in the right direction is appreciated :)
Thanks PS is there any difference between editorState.getCurrent() and editorState.current
Not sure I follow. Do you mean which Nested Content item is open?
Correct.
So right now using the editorState i have created an array of each instance of stylingOptions (this is the propertyAlias). This is on a number of nested content items, and can actually be nested within nested content. So the list for example contains 12 entries relating to stylingOptions.
The array is made up of an object which has the following fields 'stylingOptions', 'ncContentTypeAlias' and 'key'.
Now i go and open one of the Nested Content items, my JS runs so i have my array of all stylingOptions instances, i want to find out what has just been opened so i can retrieve the ncContentTypeAlias from my array.
Hope that makes more sense. and thanks for the quick response
Ouch, that is a tricky one... I don't see any obvious solution to that. Show/hide NC items is all handled in the NC edit view by checking
realCurrentNode
. It exists on a parent scope somewhere but I don't know of a good way to get that :/Thanks for your help ... will see if i can do it another way .... if anyone else can think of another way to get it, please let me know
is working on a reply...