Copied to clipboard

Flag this post as spam?

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


  • Didier Marin 17 posts 89 karma points
    Dec 16, 2020 @ 14:25
    Didier Marin
    0

    Custom data for contentPicker

    Hello we are currently trying to create a custom contentPicker. The idea is to use the standard treepicker, but with our own set of data. We've created a custom property editor, that has nearly the same properties than the multinode treepicker. Everything works fine, but we want to subset the data that are displayed in the dialog : we have content with a property "show", and we want to display only the nodes that have this property set to true. Any idea on how to filter the data displayed ? Didier

  • Corné Strijkert 80 posts 456 karma points c-trib
    Dec 16, 2020 @ 15:10
    Corné Strijkert
    0

    When you would like to go the fully custom way you could consider to create a class that inherits TreeController.

    See https://our.umbraco.com/documentation/extending/section-trees/trees

    Important to set the TreeUse = TreeUse.Dialogon the Tree attribute to prevent the tree displaying in sections. You only want it inside the picker dialog.

    You can use the GetTreeNodes method to query your tree and filter on the 'show' property.

    Then in the dialog that you're opening from your custom contentpicker controller you can add the umbraco tree directive, pointing to your custom TreeController.

    <umb-tree section="settings"
              treealias="{{treealias}}"
              hideheader="false"
              hideoptions="true"
              isdialog="true"
              customtreeparams="{{vm.customTreeParams}}"
              on-init="vm.onTreeInit()"
              api="vm.dialogTreeApi"
              enablecheckboxes="true">
    </umb-tree>
    

    Other options is to make use of the https://our.umbraco.com/packages/backoffice-extensions/contentment/ package

    Corné

  • Amir Khan 1287 posts 2744 karma points
    Dec 16, 2020 @ 15:19
    Amir Khan
    0

    Is the data outside of Umbraco or is it Umbraco nodes? Wondering if you could write an xpath that checks for your property if its the latter?

  • Didier Marin 17 posts 89 karma points
    Dec 16, 2020 @ 15:39
    Didier Marin
    0

    they are umbraco nodes

Please Sign in or register to post replies

Write your reply to:

Draft