Accessing sibling property editor value from edito...
# help-with-umbraco
a
Hi all, I've got a data model like this: - userId: string - timesheet entries: blocklist - - block 1: timesheet - - - activity: * custom I need to access the property value inside the "userId" field from the "activity" custom editor that's inside the block list. Can someone give me guidance as to how to get it?
r
I’m gonna ask all the stupid questions first So you can get the user id. Hold on to it, and then attack the block as a for each which would allow you to retain the id Or am I missing something more elemental for your solution ..
s
I think Andrew is talking about backoffice extensions and you are thinking about razor rendering Ravi
In general, it is a bad idea to read data from other property editors as it binds the property editor into its usage data model. technically i believe it can be done with $parent (or something alike, would have to look this up)
r
and this is why i was asking the silly questions to make sure it was clear?
l
Yeah, I think it's going to be one of those
$parent.$parent.$parent...
(a gazillion times) to locate the correct scope of the root document, then figure out how to find the userId property scope. 😬
j
I'd do it the other way round, and do it explicitly. Have the userId be a custom property editor that provides the data to the activity editor.
So have the userId editor update a value somewhere (on load and edit) that the activity editor can see (perhaps via the DOM, or localstorage, or the window, or any other state container).
2 Views