Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

DOM and Hierarchy


Go to End


4 Posts   1216 Views

Avatar
kindleman.com.au

Community Member, 70 Posts

4 August 2011 at 2:14pm

Hello,

I want to manage report categories in a tab in report-holder using the DOM. Categories have a parent id and many child id's - they are hierarchical

Is it possible to use DOM to manage these? And if so, how do you get it to show the nesting / hierarchy? So far, I have a DOM showing the categories with a pop up with fields name & parentid. But the hierarchy dosn't show in the table at all.

Thanks

will

Avatar
MarcusDalgren

Community Member, 288 Posts

4 August 2011 at 2:37pm

What you can do is add a DOM for the category itself or make a checkbox list to show in the popup. As far as I know the DOM can't show several levels in a hierarchy in a meaningful way, it will just show you a flat list of categories.

What you can do though is affect how the DOM writes the category names by making your own function for it and putting that in the field list. Then you could do something like what WordPress does where a sub category gets a - before the name and a sub sub category gets -- etc. After that you'd want to do some kind of custom sorting to get them to list in a good way I guess.

Avatar
kindleman.com.au

Community Member, 70 Posts

4 August 2011 at 2:41pm

Hmm, ok thanks. good idea.

Really though I want to avoid a lot of custom hacking if possible. I feel like im missing something. Silver-stripe must have a native way of dealing with hierarchical categories surely?

Avatar
MarcusDalgren

Community Member, 288 Posts

5 August 2011 at 1:05am

As far as I know there's no native way of dealing with it if we by native mean plug and play. Getting it to show the nesting isn't hard though and the function you'd have to write for it wouldn't have to be many lines. You do have two special select lists that show hierarchical content, the one built in that's used in the access tab and UncleCheese has one called SimpleTreeDropdownField that does pretty much the same thing.

Uncle Cheese has made a couple of new ones recently and maybe one of them could help you out, I don't know. Anyways, don't be afraid to get your hands dirty with some code.