Skip to main content

Bug Tracker

Side navigation

Ticket #2830: treeview_click_href.patch


File treeview_click_href.patch, 1.0 KB (added by jyrki, May 09, 2008 07:28AM UTC)

Patch to enable href and click options

Index: jquery.treeview.async.js
===================================================================
--- jquery.treeview.async.js	(revision 5497)
+++ jquery.treeview.async.js	(working copy)
@@ -18,7 +18,21 @@
 function load(settings, root, child, container) {
 	$.getJSON(settings.url, {root: root}, function(response) {
 		function createNode(parent) {
-			var current = $("
  • ").attr("id", this.id || "").html("" + this.text + "").appendTo(parent); + var current = $("
  • ").attr("id", this.id || "").html(""); + if (this.click || this.href) { + current.children("span").html(""); + current.find("a").attr("href", this.href || "#"); + if (this.click) { + var fn = this.click; + current.find("a").click(function() { + eval(fn); + }); + } + current.find("a").html(this.text); + } else { + current.children("span").html(this.text); + } + current.appendTo(parent); if (this.classes) { current.children("span").addClass(this.classes); }