WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 "&" does not work with WriteTree function, feng, August 18, 2003
     Re:"&" does not work with WriteTree function, lupus, August 28, 2003
         Re:"&" does not work with WriteTree function, lupus, August 28, 2003

Subject: Re:"&" does not work with WriteTree function From: lupus Date: August 28, 2003

Hy!

Change your xtree.js like the following and it will work -> so you kann use any HTML-Code you want!!!

 

Just change this Method (Maybe you cut 'n past it):

WebFXTreeItem.prototype.toString = function (nItem, nItemCount) {

var foo = this.parentNode;

var indent = '';

if (nItem + 1 == nItemCount) { this.parentNode._last = true; }

var i = 0;

while (foo.parentNode) {

foo = foo.parentNode;

indent = "<td width=\"16\"><img id=\"" + this.id + "-indent-" + i + "\" src=\"" + ((foo._last)?webFXTreeConfig.blankIcon:webFXTreeConfig.iIcon) + "\"></td>" + indent;

//original->

// indent = "<img id=\"" + this.id + "-indent-" + i + "\" src=\"" + ((foo._last)?webFXTreeConfig.blankIcon:webFXTreeConfig.iIcon) + "\">" + indent;

//<- original

i++;

}

this._level = i;

if (this.childNodes.length) { this.folder = 1; }

else { this.open = false; }

if ((this.folder) || (webFXTreeHandler.behavior != 'classic')) {

if (!this.icon) { this.icon = webFXTreeConfig.folderIcon; }

if (!this.openIcon) { this.openIcon = webFXTreeConfig.openFolderIcon; }

}

else if (!this.icon) { this.icon = webFXTreeConfig.fileIcon; }

//original->

// var label = this.text.replace(/</g, '&lt;').replace(/>/g, '&gt;');

//<- original

//new->

var str = "" +

"<div id=\"" + this.id + "\" ondblclick=\"webFXTreeHandler.toggle(this);\" class=\"webfx-tree-item\" onkeydown=\"return webFXTreeHandler.keydown(this, event)\">" +

"<table width=\"100%\" height=\"16\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"webfx-tree-item-table\"><tr>" +

indent +

"<td width=\"16\" height=\"16\"><img id=\"" + this.id + "-plus\" src=\"" + ((this.folder)?((this.open)?((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon):((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon)):((this.parentNode._last)?webFXTreeConfig.lIcon:webFXTreeConfig.tIcon)) + "\" onclick=\"webFXTreeHandler.toggle(this);\"></td>" +

"<td width=\"16\"><img id=\"" + this.id + "-icon\" class=\"webfx-tree-icon\" src=\"" + ((webFXTreeHandler.behavior == 'classic' && this.open)?this.openIcon:this.icon) + "\" onclick=\"webFXTreeHandler.select(this);\"></td>" +

"<td width=\"5\"></td>" +

"<td><a href=\"" + this.action + "\" id=\"" + this.id + "-anchor\" class=\"webfx-tree-item\" onfocus=\"webFXTreeHandler.focus(this);\" onblur=\"webFXTreeHandler.blur(this);\"" + (this.target ? " target=\"" + this.target + "\"" : "") + ">" + this.text + "</a></td>" +

"</tr></table>" +

"</div>" +

"<div id=\"" + this.id + "-cont\" class=\"webfx-tree-container\" style=\"display: " + ((this.open)?'block':'none') + ";\">";

//<-new

//original->

/*

var str = "" +

"<div id=\"" + this.id + "\" ondblclick=\"webFXTreeHandler.toggle(this);\" class=\"webfx-tree-item\" onkeydown=\"return webFXTreeHandler.keydown(this, event)\">" +

indent +

"<img id=\"" + this.id + "-plus\" src=\"" + ((this.folder)?((this.open)?((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon):((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon)):((this.parentNode._last)?webFXTreeConfig.lIcon:webFXTreeConfig.tIcon)) + "\" onclick=\"webFXTreeHandler.toggle(this);\">" +

"<img id=\"" + this.id + "-icon\" class=\"webfx-tree-icon\" src=\"" + ((webFXTreeHandler.behavior == 'classic' && this.open)?this.openIcon:this.icon) + "\" onclick=\"webFXTreeHandler.select(this);\">" +

"<a href=\"" + this.action + "\" id=\"" + this.id + "-anchor\" class=\"webfx-tree-item\" onfocus=\"webFXTreeHandler.focus(this);\" onblur=\"webFXTreeHandler.blur(this);\"" + (this.target ? " target=\"" + this.target + "\"" : "") + ">" + this.text + "</a>" +

"</div>" +

"<div id=\"" + this.id + "-cont\" class=\"webfx-tree-container\" style=\"display: " + ((this.open)?'block':'none') + ";\">";

*/

//<- original

var sb = [];

for (var i = 0; i < this.childNodes.length; i++) {

sb[i] = this.childNodes[i].toString(i,this.childNodes.length);

}

this.plusIcon = ((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon);

this.minusIcon = ((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon);

return str + sb.join("") + "</div>";

}


From: feng
Sent: August 18, 2003
Subject: Re:"&amp;" does not work with WriteTree function

Hi,

I have a problem of passing parameters into an asp page to dynamically genterate the tree. the code is like following:

sSrc="xmlsearch_result.asp?requestor="&requestor&"&amp;reqID="&nodeid&"&pid="&amp;pid

call WriteTree("Search Results",sSrc,action,sIcon,"")

It looks like the "amp;" escape value causes the asp page to ignore the passed in parameters but without them the xml code will error out and the tree will not work.

Any help is appreciated.

 

Feng





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX