Copied to clipboard

Flag this post as spam?

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


  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 24, 2015 @ 20:54
    bob baty-barr
    3

    does nested content get an id value?

    okay, so i am probably trying to use this in a way that it shoudln't be used... but here is what i am doing. I am trying to use this to put a poll in a grid. I have a docType poll question and i have nested PollAnswers on that docType... 

    PollAnswers has a property for votes... i would like to update that field, but would need to get the answer ID to do so... is this even possible? how would I identify the content then how coudl i update that property with content service?

    excited to learn ;)

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 25, 2015 @ 09:15
    Matt Brailsford
    3

    Hey Bob,

    Unfortunately nested content can't have an ID value as they don't truly exist, so giving them a Node ID would potentially cause issues / conflicts.

    My best suggestions would be to add a property on your answers for "key" or "id" and have this be entered by the content editor. You could then look this up within your loop.

    In terms of saving data back to the property, this is probably going to be a bit tricky as again, the node doesn't truly exist. The only thing you could update is the raw NC value, but I wouldn't suggest that.

    What I would probably look to do is use a custom DB table to record the votes. So if you do add a "key"/"id" field to your doc type, you could then create a table to record votes in (id + votecount) and then read the value from the database, rather than from the doc type property itself.

    Really good question though bob, and has really made me think. I think ultimately, NC should basically be considered read only.

    Hope this helps

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 25, 2015 @ 11:45
    Lee Kelleher
    3

    It is really good question... which raises more questions! (That we don't have answers for yet) ;-)

    If I was building this, I'd probably build the poll questions/answers as separate standalone nodes - then you can do the coding side of it however you would do previously. Then for the Grid, you could use a Content Picker (via DocTypeGridEditor) to select the poll (node).

    That way you can still make the Grid item (cell) look nice/styled... and the logic/guts of the poll data is held elsewhere.

    Main downside is extra nodes in your content tree.

    Cheers,
    - Lee

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 25, 2015 @ 13:07
    bob baty-barr
    1

    yup, i quickly came to the same realizations...

    but i do like the picker for the poll and am implmenenting that with DocTypeGridEditor for sure!

    thanks for the quick feedback... these new packages ROCK!

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 25, 2015 @ 15:20
    Hendy Racher
    1

    Hi Lee, Matt, have you considered adding a read only property to DetachedPublishedContent so as to be able to identify the index of the NestedContent item ? that'd be really useful. Would it be also be wise / possible to set the Parent property to be the hosting IPublishedContent ?

    A unique key on DetachedPublishedContent would be very helpful, perhaps a combination of the hosting IPublishedContent(s) + the index ?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 25, 2015 @ 15:31
    Lee Kelleher
    0

    Good points Hendy. Let's raise an issue on GitHub, we can explore further.

    https://github.com/leekelleher/umbraco-nested-content/issues

    (I guess this applies to DocTypeGridEditor too?)

    Cheers,
    - Lee

  • Zac 223 posts 575 karma points
    Jul 21, 2016 @ 15:24
    Zac
    1

    I've been thinking about this. It would be great if Nested Content created an Id for each item internally, and then came with a special "Nested Content Picker" data type to allow choosing of Nested Content items (i.e. in another NC item or in another node).

    Some people may say "why don't you just create normal nodes?". Well, I do have to create normal nodes, but I don't want to, because:

    1. Normal nodes feel a bit dirty and heavy to me when you don't attach a template and just intend them to model some data.

    2. Normal nodes, even with list view, are much slower to manage when creating a complex content model. Many more page loads, forced to give the node a name, etc.

    Nested Content is just a really neat way of giving your CMS users a complicated content structure that is not relevant to the node structure of your website and removes a huge amount of UI and slowness.

    Note: I understand what I am asking for in having a "Nested Content Picker" is rather a lot of work and isn't neccessarily a common requirement.

Please Sign in or register to post replies

Write your reply to:

Draft