留言板

AUI:TreeView - how to append the link to a leaf

Rovere Li,修改在9 年前。

AUI:TreeView - how to append the link to a leaf

New Member 帖子: 4 加入日期: 14-9-21 最近的帖子
Hello,
I'm using AUI:TreeView to create the navigation, can you please advise how to append to the link (href) to a leaf? I tried the following ways but faild.

Here is my code:

<div id="myTreeView"></div>
<aui:script>
YUI().use(
'aui-tree-view',
function(Y){
var children = [
{
children: [
{
label: 'Nav 1',
type: 'HTML',
html: '<a href="${ViewMaterialsURL}"></a>',
leaf: true
},
{
label: 'Nav 2',
leaf: false
},
{
label: 'Nav 3',
leaf: true,
href: 'http://www.google.com'
}
],
expanded: true,
label: 'Root'
}
];

new Y.TreeView(
{
boundingBox: '#myTreeView',
children: children
}
).render();
}
);
</aui:script>
thumbnail
Drew Brokke,修改在9 年前。

RE: AUI:TreeView - how to append the link to a leaf

New Member 帖子: 12 加入日期: 14-1-9 最近的帖子
Hi Rovere!

You can actually put your HTML straight into the label attribute. You would end up with something like:

children: [
	{
		label: '<a href="${ViewMaterialsURL}">Nav 1</a>',
		leaf: true
	},
	{
		label: 'Nav 2',
		leaf: false
	},
	{
		label: '<a href="http://www.google.com">Nav 3</a>',
		leaf: true
	}
],
expanded: true,
label: 'Root'
Rovere Li,修改在9 年前。

RE: AUI:TreeView - how to append the link to a leaf

New Member 帖子: 4 加入日期: 14-9-21 最近的帖子
Yes, it works! Thanks Drew.