Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Murray Roke 467 posts 875 karma points c-trib
    Sep 22, 2010 @ 23:13
    Murray Roke
    0

    Using BaseTree and BaseTreePicker HowTo?

    Hi all / Shannon :-)

    I am trying to write a dataType which allows a user to pick multiple nodes from an XML document. And store them as comma separated values in a property field.

    I'd like to represent the relevant data from the xml file as a tree using umbraco.cms.presentation.Trees.BaseTree (I've created this class already based on this BaseTree tutorial on umbraco.tv this video shows creating application trees rather than data types.)

    If there is any documentation/tutorials other than the video above, I haven't found it yet :-)

    Cheers.

    Murray.

  • Shannon Deminick 1510 posts 5195 karma points hq
    Sep 23, 2010 @ 06:08
    Shannon Deminick
    2

    You hae to first create the BaseTree so that you can render your data using the tree control.

    Once you have your BaseTree created, you'll need to test it to make sure it works. You'll also need to register your tree in the database tables (if you haven't done this already). However, since you are only going to be using your BaseTree for a data type, you'll want to flag it in the database to not be initialized otherwise it will show up in one of your applications normally. To test your BaseTree, you can set it to initialize so that you can make sure it is rendering properly in the normal tree.

    From there, you can create a data type to use the tree control. Before v4.5.2 there was a bug in the tree control where it was not possible to render a standalone tree without rendering the entire application. This is fixed in 4.5.2 but if you want your data type to work in previous versions, you'll have to look into using the CompositeTreeControl inside of uComponents (which has a 'work around' for this limitation).

    A good place to start your research on the different ways you can implement this is to have a look at the original Multi-node tree picker that was created at CodeGarden 2010:

    http://farmcode.org/post/2010/06/29/Multi-node-tree-picker-source-code-from-CodeGarden-2010.aspx

    This is using the standard tree control inside of Umbraco and rendering the content tree. You would need to change yours to tell the treecontrol to render your specific TreeType.

    You can start with that and then post back the questions you might have once you start the implementation.

    hope this helps.

    Shannon

  • Shannon Deminick 1510 posts 5195 karma points hq
    Sep 24, 2010 @ 00:32
    Shannon Deminick
    0

    If it's a single node picker control that you want (i.e. like the content picker or media picker), then you can use the BaseTreePicker inside of Umbraco core which is what the content picker and media picker extend from. In fact there's 2 composite controls in Umbraco core called: SimpleContentPicker and SimpleMediaPicker that can be used. If you look at the code for these you can learn how to create a custom single node picker which will launch in an overlay.

    If you need a picker to select more than one node however, you will need to use the method described above.

  • Murray Roke 467 posts 875 karma points c-trib
    Sep 24, 2010 @ 03:27
    Murray Roke
    0

    For others reading ... I've found a post by rasb explaing how to make your BaseTree show children

    http://our.umbraco.org/forum/developers/extending-umbraco/3122-Custom-section-in-Dashboard?p=1

  • Murray Roke 467 posts 875 karma points c-trib
    Sep 26, 2010 @ 22:41
    Murray Roke
    0

    Hi

    I've decided to change tack slightly and have a new applicaiton tree to represent my XML. and from each node pick multiple content. Because this will provide a more intuitive way for users to deal with the content.

    I may still do the original so that the 'relationship can be edited from both ends'. (but not yet)

    In any case this means putting an MNTP_DataEditor in the page which represents an xml node. and it works great for picking multiple content with one exception:

    The list of picked nodes does not render correctly on postback. they save and load correctly in all other scenarios. I put a watch on MultiPromoPicker.SelectedIds and it appears to have the correct values at Page_PreRender, BUT, any existing or deleted items are shown (as the 3 icons with no title), any new items are not shown at all. (see source code) NB: the code is all a bit 'backwards' to deal with the fact I'm editing the foreign items selected rather than the item navigated to.

    Any clues?

    Cheers.

    Murray.

  • Shannon Deminick 1510 posts 5195 karma points hq
    Sep 28, 2010 @ 04:29
    Shannon Deminick
    0

    I'm really not sure based on your description what you are actually doing?

    I'm assuming this particular issue has nothing to do with the title of this thread?

    If this is an MNTP issue, perhaps you can post the question on the uComponents forum with some screen shots showing what it is you are attempting to do. Sorry, just need some more/clear info on what you are building/trying.

    Cheers,

    Shannon

  • Murray Roke 467 posts 875 karma points c-trib
    Sep 28, 2010 @ 23:43
    Murray Roke
    0

    ok, I've posted a codeplex issue, I've included simplified sample code which uses session to persist your edits.

    I've included a screenshot of one of the display issues.

    I'm guessing most people aren't usin the MNTP in this way, but It would be excelent to be able to.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies