Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Gregory 402 posts 1554 karma points MVP 2x admin c-trib
    Jun 16, 2019 @ 05:09
    Peter Gregory
    0

    Get the organisational folders from the documenttype tree in Angular

    I'm working on a project where I have a document type picker. My documentTypes are organised in folders eg:

    - Elements Folder [id: 1053]
    |- MyCoolDoc [id: 1066]
    |- MyBetterDoc [id: 1073]
    

    I can get a list of document types using the contentTypeResource like this:

    contentTypeResource.getAll()...
    

    This is great but it only returns the actual document types and not the folders. I.E. I am only getting back MyCoolDoc and MyBetterDoc

    I can see that the doctype entities returned have a parentId and this parentId corresponds to where it is sitting in the tree. I can see that the ID's correspond to the folder I want, but at the moment I am having to hardcode my ID in my filter for the folders [eg 1053] as I can't find a good way to query out folder.

    Is there another way I can get at this data so I can query for the folder, and then its child entities?

  • Tarik 144 posts 641 karma points
    Jun 16, 2019 @ 07:00
    Tarik
    0

    I don't have a ready machine for testing currently, I suggest to test entityResource getById and getAncestors functions.

  • Peter Gregory 402 posts 1554 karma points MVP 2x admin c-trib
    Jun 16, 2019 @ 11:10
    Peter Gregory
    0

    Thats where I started off, but unfortunately the entityResource does not return the folders either. Also, entityResource returns the icon attribute of the document types as null. contentTypeResource returns all the properties.

    I think that because the organisation folders are not really document types they probably won't be returnable.

    I will just have to put a prevalue setting in somewhere and set the root :-(

    Might raise an issue to get it looked at.

  • Dan 1243 posts 3708 karma points admin c-trib
    Jun 19, 2019 @ 10:10
    Dan
    0

    Hey Peter,

    I have a use-case for this in the long-term but haven't looked at doing anything about it yet. My one and only thought so far is that there's an instance whereby this already happens in the CMS, so I'd probably start digging in there. If you're editing a document type in the Settings section and you click the 'Composition' link at the top right it opens a side-panel which shows all of your document types in their respective folders.

    I had a vague memory Kenn Jacobsen implemented this last year some time and having trawled through his millions of incredible contributions from the past few months I found this: https://github.com/umbraco/Umbraco-CMS/pull/3900.

    Does this help?

Please Sign in or register to post replies

Write your reply to:

Draft