Nibble

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.

image

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:

image

Parent nodeid is set the id of container.

CheckBoxList (can select multiple nodes)

image

DropDownList (will save 1 selected node)

image

ListBox (can select multiple nodes)

image

RadioButtonList (one node)

image

AutoComplete (one node)

image

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

28 Comments so far

  1. Kenneth Solberg on July 20th, 2008

    Excellent work Tim - two thumbs up!

  2. Jon Cuthbert on July 20th, 2008

    This is perfect, the exact missing piece I wanted in Umbraco! Thanks.

  3. Greg on July 21st, 2008

    Awesome! can’t wait to try it out :)

  4. Petr Snobelt on July 21st, 2008

    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

  5. Ismail Mayat on July 21st, 2008

    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

  6. Mikkel Keller on July 29th, 2008

    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

  7. Chris on August 3rd, 2008

    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

  8. Thomas Kahn on August 12th, 2008

    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

  9. Nik on September 19th, 2008

    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

  10. Tim Geyssens on September 21st, 2008

    Nik, I mailed you the source.

  11. Nik on September 22nd, 2008

    Tim, haven’t gotten it I’m afraid. Could you please try again? ;) Thanks!

  12. Ricardo Fiel on November 20th, 2008

    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.

  13. Lieven on February 19th, 2009

    Super package Tim!
    Werkt perfect :)

  14. Cem Sisman on February 23rd, 2009

    Can i have the source files please?

  15. Johan Möller on March 12th, 2009

    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.

  16. David Conlisk on March 19th, 2009

    Nice work Tim - works like a charm!

  17. esunxray on April 28th, 2009

    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.

  18. esunxray on April 28th, 2009

    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.

  19. Stephan on May 14th, 2009

    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

  20. Ravi Gupta on March 30th, 2010

    Nice work.

  21. Daniel on February 21st, 2011

    Looks great! Do you know a way to populate the dropdown with a certain member group?

    I want to create a member group with contact persons. And when creating a page I want to assign a contact person to that page with some info listed from the members profile. You write it only works with “content” and “media” is this still so? Would be neat to list a member node too.

    Thanks :)

  22. J.P. van Popta on March 17th, 2011

    Not sure if mentioned anywhere, but… I get errors if I choose ‘radiobuttonlist’ on an unpublished page, with no ‘results’ for the picker.

    Example: I made a news node (newsDoc), which has images underneath them (children of imagesDoc).
    I made a custom ultimate Picker, which uses $currentPage as Parent NodeID, so it will show only the pics from the current newsnode.
    (btw, I see the text ‘…. are available when published’, … ??).
    With RadioButtonList you’ll get an ‘nullreference ‘ error. With all other options ‘list, dropdownlist, etc’ it works ok.

    with already published docs you’ll get a empty ‘place’ with a ‘clear’ button, but no clear button if you make a new ‘node’ unpublished with the picker as option.

    I fixed the error, put a ‘if (clearRadiobuttons != null)’ in ultimatePickerDataEditor.cs (row 175), which fixes the error but still doesn’t show the button (after reload you’ll see ‘m though)…

    So… just to let you know. (btw I use Umbraco 4.6.0, we already ‘converted’ it for 4.6.0). Hope you can make sense out of my story :)

    JePe. (Basic Orange - Netherlands)

    the error:

    [NullReferenceException: Object reference not set to an instance of an object.]
    BO.Umb.UltimatePickerXPath.ultimatePickerDataEditor.Save() 2197
    umbraco.controls.ContentControl.saveClick(Object Sender, ImageClickEventArgs e) 184
    umbraco.controls.ContentControl.savePublish(Object Sender, ImageClickEventArgs e) 23
    System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) 133
    System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) 164
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint

  23. voyeur on May 19th, 2012

    Thanks for any other great post. The place else may anybody get that type of info in such
    a perfect method of writing? I’ve a presentation next week, and I’m on the look for such info.

  24. Paolo Brocco on June 13th, 2012

    Hi, I’m using your ultimate picker (thank you) in a big website, I recently noticed the following problem: when I pick a node with ID greater then 10000 (10thousand) the node with the ultimate picker as property is saved and published, but when I go back and edit the node, the ultimate picker field does not contain the name of the node. I did several tests and wherever I select an “older” node (with ID lower than 10000 it works). Is it possible that you have set a limit to 9999 or something like that in your code? If so would be nice to have a fix, or if you have no time, to share your code would be nice. Thanks and cheers, Paolo

  25. Paolo Brocco on July 5th, 2012

    Tim, are you still alive? Whatever… I noticed that the ultimate picker is not an external package (was almost sure it was, as it’s downloadable here) but I can see it’s part of the official umbraco installation (at least 4.7.x). So fyi I filed the bug there: http://umbraco.codeplex.com/workitem/30873

  26. Hi there, just become alert to your blog via Google,
    and found that it is truly informative. I’m going to
    watch out for brussels. I’ll be grateful should you
    continue this in future. A lot of other people
    will likely be benefited out of your writing.
    Cheers!

  27. Crandle on September 28th, 2012

    This is a brilliant tool. The source is available on Codeplex so you can customise it as you see fit.

    For example, we added some extra datatypes to the list in the Ultimate Picker. e.g. a dropdown list that remembers the selected value

    Perhaps this

  28. Ronnie on May 26th, 2013

    Howdy just wanted to give you a quick heads up and let you know a
    few of the pictures aren’t loading correctly. I’m not sure why but I think its a
    linking issue. I’ve tried it in two different web browsers and both show the same outcome.

Leave a Reply