Copied to clipboard

Flag this post as spam?

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


  • Ulrich Wagner Gade Ebsen 127 posts 277 karma points
    Apr 06, 2021 @ 00:08
    Ulrich Wagner Gade Ebsen
    0

    Context ID

    A quick question: Is it possible to use the current node id with a custom datasource, so I can filter the datasource by the node id that I'm editing?

    /ulrich

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Apr 06, 2021 @ 08:30
    Lee Kelleher
    100

    Hi Ulrich,

    It's possible, by checking the querystring. Here's an example from how I do it with the Umbraco Content data-source...

    https://github.com/leekelleher/umbraco-contentment/blob/1.2.1/src/Umbraco.Community.Contentment/DataEditors/DataList/DataSources/UmbracoContentDataListSource.cs#L62-L72

    ...although, it's not fool-proof, as it doesn't work within Nested Content. I've no idea about other embedded/repeatable element editors, e.g. BlockList, or Grid/DTGE. It's all about if the contextual node ID is passed in the querystring.

    Good luck!

    Cheers,
    - Lee

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies