I'm in the middle of making my first umbraco tree. It will never be associated with an application section. Instead, it will be used exclusively as a modal picker for a custom data type. I want it to work similarly to the content picker data type.
So my questions are:
If the tree isn't part of an application, does it actually need to go in the [umbracoAppTree] table?
If so, do I just leave the [appAlias] column blank?
If not, will the custom tree be automatically picked up, similarly to the data type itself?
You need to configure the tree in the database. but you could also use the content tree I think. What I would suggest is to pick a custom tree project on this site and look at their source code to see how they solved the issues.
Thanks for the response Richard. I think you might be right. Combing through other projects, I can't see any evidence of umbraco Trees without an application and database records to match.
But then, the concept of app independent trees is at least alluded to around the place. For example in Shannon Deminick's article on FARMCode.org (and also here):
TreeAlias
By default this is set to the alias name specified in the umbracoAppTree table. However, in some cases not all trees will be defined in the database and therefore this property should be overridden.
Analysing the source code for TreeDefinitionCollection, it at least looks *possible*. I guess I'll have to run the umbraco project locally, attach the IIS process and step through the code to see if my custom Tree gets picked up. *sigh* :)
P.S. The only reason I'm pushing this is that it's really inappropriate for this tree picker to associated with any app. It really should be independant. Plus, I don't want any database requirements to make it work.
Hey Richard. I've marked your answer as the solution. It wasn't what I wanted to hear, but you were 100% right :)
I'm going to put some suggestions forward about how the new tree works. There are some strange behaviours (especially around tree pickers) that could be improved.
Be sure to get some suggestions up, it's what this community is about, sharing and improving the product so the whole community can benefit from this. +1 from me!
I'm currently looking into exactly the same thing: Making my own custom data type with a custom tree / custom picker, generated from an external data source.
I know how to make custom sections and trees in Umbraco, just can't wrap my head around how / if this can be used for a data type.
Would be nice with some suggestions from the experts on how to solve this, as it seems like a common problem.
While it is possible to create your own copy of TreeControl (/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx) to do what you want, you then need to make your own picker page (/umbraco.presentation/umbraco/dialogs/treepicker.aspx) to contain the control. That also stops you using TreeUrlGenerator, because you'll be using your own page. And so on... *sigh*
That's a lot of custom work when the base implementation is so close!
I had a short look at Shannon's Multi-node Tree Picker. Looks like it's using some sort of umbraco user control for the tree, however it seems like this is only part of Umbraco v4.5. Which I'm not using yet.
So the option possibly is to look outside of Umbraco for a solution, maybe there's some jquery thing that can turn XML data into a tree.
Custom Tree, No Application Section
I'm in the middle of making my first umbraco tree. It will never be associated with an application section. Instead, it will be used exclusively as a modal picker for a custom data type. I want it to work similarly to the content picker data type.
So my questions are:
Appreciate your help!
Hi Ben,
You need to configure the tree in the database. but you could also use the content tree I think. What I would suggest is to pick a custom tree project on this site and look at their source code to see how they solved the issues.
Hope this helps you,
Richard
Thanks for the response Richard. I think you might be right. Combing through other projects, I can't see any evidence of umbraco Trees without an application and database records to match.
But then, the concept of app independent trees is at least alluded to around the place. For example in Shannon Deminick's article on FARMCode.org (and also here):
Analysing the source code for TreeDefinitionCollection, it at least looks *possible*. I guess I'll have to run the umbraco project locally, attach the IIS process and step through the code to see if my custom Tree gets picked up. *sigh* :)
P.S. The only reason I'm pushing this is that it's really inappropriate for this tree picker to associated with any app. It really should be independant. Plus, I don't want any database requirements to make it work.
OK, results time. Stepping through the code revealed some good news and some bad news.
Good news: Custom trees are detected based on their base type or interface. My tree was found :)
Bad news: Custom trees are not registered unless they have a matching app. My tree was rejected :(
Interestingly, I can get my custom non-application tree to work using the "old" tree method. Just not the new 4.1 way. *double sigh*
I'm going to bang away at this a little longer before I try alternative methods.
Hey Richard. I've marked your answer as the solution. It wasn't what I wanted to hear, but you were 100% right :)
I'm going to put some suggestions forward about how the new tree works. There are some strange behaviours (especially around tree pickers) that could be improved.
Hi Ben,
Be sure to get some suggestions up, it's what this community is about, sharing and improving the product so the whole community can benefit from this. +1 from me!
Cheers,
/Dirk
I'm currently looking into exactly the same thing: Making my own custom data type with a custom tree / custom picker, generated from an external data source.
I know how to make custom sections and trees in Umbraco, just can't wrap my head around how / if this can be used for a data type.
Would be nice with some suggestions from the experts on how to solve this, as it seems like a common problem.
/SoerenS
Hey Soeren. I know exactly what you mean. My implementation involves an external data source too (though I'm not ready to say what it is ;).
I ended up posting this as a suggestion over here: Suggestion: App Independent Trees. Please give it a high five if you agree.
While it is possible to create your own copy of TreeControl (/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx) to do what you want, you then need to make your own picker page (/umbraco.presentation/umbraco/dialogs/treepicker.aspx) to contain the control. That also stops you using TreeUrlGenerator, because you'll be using your own page. And so on... *sigh*
That's a lot of custom work when the base implementation is so close!
Hi-five given :-)
I had a short look at Shannon's Multi-node Tree Picker. Looks like it's using some sort of umbraco user control for the tree, however it seems like this is only part of Umbraco v4.5. Which I'm not using yet.
So the option possibly is to look outside of Umbraco for a solution, maybe there's some jquery thing that can turn XML data into a tree.
/SoerenS.
is working on a reply...