New Package - Ultimate Picker
The ultimate picker is a new datatype which will be a default datatype in umbraco v4. But I decided to also package this up so it could be used in lower versions.
Basically it’s about combining a datasource (umbraco node, content or media) with a control (AutoComplete, CheckBoxList, DropDownList, ListBox and RadioButtonList).
After installing the package. You’ll have to create a new datatype and choose ‘ultimate picker’ as the rendercontrol.
So the configurations options are:
Database datatype: In wich field the value will be saved
Type: type of control that will be shown, you can choose from AutoComplete, CheckBoxList, DropDownList, ListBox and RadioButtonList
Parent nodeid: the nodeid to use, the descendants will be the nodes you can choose from, this can be a contentnode or a medianode
Show grandchildren: check this if you want to include all descendants, not only the direct children of the parent node.
After configuration it’s ready to be used as a property on a document type.
Picker in action:
Parent nodeid is set the id of container.
CheckBoxList (can select multiple nodes)
DropDownList (will save 1 selected node)
ListBox (can select multiple nodes)
RadioButtonList (one node)
AutoComplete (one node)
The picker will save the nodeid’s, in cause of multiple selected values this will be a comma seperated list of nodeid’s.
Ultimate Picker: download

Excellent work Tim - two thumbs up!
This is perfect, the exact missing piece I wanted in Umbraco! Thanks.
Awesome! can’t wait to try it out
Hi, nice control.
2 suggestions:
Allow add restrictions to selectable document type
Allow dynamic parentnode id (for example by level). When creating multi-lang sites, I don’t want allow users to pick node from different language.
Thanks Petr
Tim,
Great work. I really like the autocomplete selector thats uber cool, i have found that most editors sort of know what they are looking for by title / keyword so its way quicker to type and find that traverse a tree!
Regards
Ismail
Hi Tim
This is really great. This functionality can be used extensively when relating content. I made a way simpler version for http://suzuki.dk to relate cars, models, motors etc. My datatype selected the parent node based on an XPath query on the content tree instead of the nodeId. This way you’ll be able to select different parent nodes in different contexts (eg. when creating multi-lang sites).
I have ditched my own datatype, in favour of the Ultimate Picker on my current project, unfortunately I just experienced that the user are unable to deselect all items when an item once has been selected. It would be very nice to have this opportunity, or in other words, I personally need this functionality
Are there any way that you would consider changing this behaviour or alternatively, can I get my hands on the source?
Regards
Mikkel Keller
Hi Tim,
I have been create a new datatype that I am looking to package up at some point. One thing I have not worked out how to do (and I see from your screen shot you have) is how do I add my own configuration options? E.g. Like your ParentID… in your screen grab above.
It would be great if you can point me in the right direction, or of you have any code examples I could have a look at?
Thanks in advance,
Chris
Hi Tim! Great work! I submitted a question on the Umbraco forum regarding this add-on, but I don’t know if you have seen it(?) so I thought I’d ask here as well:
Is it possible to have NO node selected? I’m working on a solution where the user should be able to pick 0, 1, 2 or 3 banners to show on the firstpage and I’m having a hard time getting the 0 (zero) alternative working.
Is it possible?
/Thomas K
Hi Tim,
I like the new ultimate picker, but I’m in need of a way to make only certain doc types selectable (my needs are much the same as Petr’s). Any chances to make this happen or let us have a look at the source?
Nik
Nik, I mailed you the source.
Tim, haven’t gotten it I’m afraid. Could you please try again?
Thanks!
Hi. This is great! But on my current project, I need to specify XPath instead of NodeId. Would it be possible to have the source code? Thanks.
Super package Tim!
Werkt perfect
Can i have the source files please?
Hey, did ur “guide” but id like if u coud show what id put in the template to show the content from the page i have chosen with content picker.
Currently its only showing ID. Cant seem to find any information on how to do this.
Nice work Tim - works like a charm!
suggestions:
1. can parentId be a relative xpath like: $currentPage/ancestor-or-self[@level=1]?
By this way, multisite can use only one picker to do all,No need to create each picker for each site.
2. can filter the selected document like: @nodeTypeAlias=’Board’ and data[@alias=’Topic’]=1
By this way, I can only select Board with Topic=1
hope to see these in umbraco 4.0.2.
I have submit one issue on codeplex, which include one picture may let you know that I want directly.
http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=22200
thank you for great work.
Hi Tim!
Excellent work, I tried to implement an XPath, which seems to be working (at least enough for my needs). But since you shared your code, I thought I should share mine.
You’re the expert here, so any feed-back is greatly appreciated.
I added a method,
private int getParentNodeIdFromXpath(string xpath)
{
int retVal = -1;
if (Int32.TryParse(xpath, out retVal))
return retVal;
else
{
int currentNodeId = ((umbraco.cms.businesslogic.datatype.DefaultData)_data).NodeId;
try
{
XPathNavigator navigator = content.Instance.XmlContent.CreateNavigator();
string Expression = xpath.Replace(”$currentPage”, “//node[@id=’” currentNodeId “‘]”);
retVal = Int32.Parse(navigator.SelectSingleNode(navigator.Compile(Expression)).GetAttribute(”id”, String.Empty));
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, currentNodeId, ex.ToString());
}
return retVal;
}
}
And on the OnInit(EventArgs e) method I changed:
int parentNodeId = Int32.parse(config[1]);
to
int parentNodeId = getParentNodeIdFromXpath(config[1]);
What do you think?
BR
Stephan