Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Apologies if my terminology isn't quite on track here but I'll try my best...
Think of the following case where a "Country" is within a "Region". For example, UK resides within Europe and Australia resides with Oceania.
To achieve this structure in Umbraco, I understanding in Umbraco that I can either:
A) On a "Country" document; add a ContentPicker2 to select he country's "Region".
B) On the "Region" document; add a MultiNodeTreePicker2 to select multiple "Countries".
My specific question is; does Umbraco include the means for this selection to be made from both the "Country" and the "Region" using the same underlying data (which I assume is a many-to-many link within the database).
I've tried looking through the documentation and support forums but cannot find the answer - sorry.
Thanks in advance,
another solution could be creating a parent Region node that contains Country childnodes.
Then you have a nice structured way and then you can use easy queries for getting the two-way binding.
Get all children on a region page:
var countries = Model.Content.Children;
Get the region on a country page:
var region = Model.Content.Parent;
Hope this helps.
yeah, I've got that in place already...
The reason that I want to be able to administer the data (via the CMS) from both ends is ease-of-use for the client.
For example, say if the nodes in question are staff and office (i.e. a member of staff resides within a single office). When setting up a new office it would be great to pick staff from a multinodetreepicker, right? But, in the case where an existing staff member moves office; you really want to go to the staff member CMS page and change their office from a single picker?
Am I making sense here?
its kind of confusing because first you talk about Regions and Countries and now Staffs and Offices!
That at a side node.
Maybe you can show your current content node structure with a screenshot? Then we can have a better view and understanding.
I only attempted to provide a practical example because it was more pertinent to the second example - sorry.
That's my document structure;
On Regions I have a multinodepicker of Countries where the CMS admin can select one or more countries within a region.
This is absolutely fine and on the front-end I have absolutely no problem getting a Region for a Country in code.
If the CMS admin visits a Country in in the back-end then they cannot see or change the Region for that Country since the relationship only exists on the Region node.
Are you with me?
Yes I understand it completely, that's why I suggested the other solution in my first post. Then you don't have this problem and you don't need any single or multi content pickers.
The only thing you have to do is create a region node and allow country nodes to be added as children.
Below you can find a simular example in one of our projects:
So we have a country België and Nederland which have child cities.
Then on the België we use:
var cities = Model.Content.Children;
to have a list of all cities in België.
Then on the for example Brugge content node, we use:
var country = Model.Content.Parent;
to have the country of the city.
Oh yea, I get ya :)
We've used that technique in the past and your suggestion makes complete sense buddy, thank you :)
I guess that I was only using that as an example and the second example of staff and offices may be more pertinent.
We could use the same node/child-node solution you have given here but we would lose in other areas; like the ability to use a single list-view to see all items across all parents. Not the end of the world, but I'm just trying to ascertain what's possible with this excellent CMS.
I'm gonna have a go with the relations thing like Ismail suggest.
Thanks again buddy :-D
You can create relations and use relations package.
Thank you Ismail,
I will look into this plugin and see if I can work it all out.
I'll report back either way.
You guys rock!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted