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
Ravi
12/10/2023, 5:33 PM
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
Sven Geusens
12/11/2023, 8:57 AM
I think Andrew is talking about backoffice extensions and you are thinking about razor rendering Ravi
Sven Geusens
12/11/2023, 9:05 AM
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
Ravi
12/11/2023, 10:23 AM
and this is why i was asking the silly questions to make sure it was clear?
l
leekelleher
12/11/2023, 11:28 AM
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
Jason
12/11/2023, 5:11 PM
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.
Jason
12/11/2023, 5:20 PM
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).