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.

Customising the CMS /

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

CMS Pages like tree structure Silverstripe 3


Go to End


5 Posts   1618 Views

Avatar
SS_Learner

Community Member, 20 Posts

5 April 2013 at 1:54pm

Hi Friends..

I was looking a way to make another menu in CMS which will show my own tree structure (not the pages) in Silverstripe 3 ..
I know it uses the jstree for this,but i need a way to start,any help is appreciated.

Thanks

Avatar
SS_Learner

Community Member, 20 Posts

11 April 2013 at 1:07pm

I added a div with id demo and i know that the jquery.jstree.js is included as soon as the cms is opened in silverstripe 3.
In the init() function u included the my javacrript to create the jstree in the div demo.
and my js code is this:

$("#demo").jstree({
"json_data" : {
"data" : [
{
"data" : "A node",
"metadata" : { id : 23 },
"children" : [ "Child 1", "A Child 2" ]
},
{
"attr" : { "id" : "li.node.id1" },
"data" : {
"title" : "Long format demo",
"attr" : { "href" : "#" }
}
}
]
},
"plugins" : [ "themes", "json_data", "ui" ]
}).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("id")); });

But i am not able to show any tree in the demo div.
May be i am missing any file or may be some other issue,i am not abe to find any javascript error in console.
Can someone help me with this please?
Thanks

Avatar
chrclaus

Community Member, 29 Posts

10 August 2013 at 12:02am

Hi SS_Learner,

did you find any solution for your problem?

Best regards,
chrclaus

Avatar
SS_Learner

Community Member, 20 Posts

26 August 2013 at 1:36pm

Hi chrclaus..
I was able to do this jstree in silverstripe 3 CMS,my issue at that time was my javascript for the js tree was loading after the div making the jstree..
Then i included my jstree javascript code in ss file,and it all worked as i wanted to..

Thanks

Avatar
chrclaus

Community Member, 29 Posts

26 August 2013 at 7:33pm

Hi SS_Learner,

is it possible for you to explain your solution more in detail? I have no idea where to start (which class I should extend ...). I think, modelAdmin is not the richt choice, isn´t it?

Best regards,
chrclaus