/* Copyright Paul Hanlon (paulhan@eircom.net) Licence MIT, BSD, same as jQuery; Please leave the above copyright notice with this code, if for no other reason than people wanting to get in touch for help/support. Not much here in the way of documentation. I'm hoping the demo on the website at http://www.hanpau.com/jquery/unobtrusivetreetable.php will explain most of it, particularly how the map is constructed. The options are mostly the images you need to render the tree properly, with the last five being:- collapse: Either false or an array of parents to collapse. Just put in the highest level nodes, this will recurse down through the children and collapse them, without them having to be specified as well. Even if you only set one parent to be collapsed, it must be in [] brackets. column: A zero based number of the column you want to render the tree in. stripe: Set to true if you want to have striping on alternate rows. False returns a plain treetable. An "even" class needs to be set in CSS for background-color. highlight: Set to true if you want to highlight the row that is being hovered over. An "over" class needs to be set in CSS for background-color. onselect: Callback function where you can set what you want to happen when a td is selected Forces highlighting on td even if there are other elements within. Links and events still work though. */ (function(jq){ var mapa = [], mapb = [], num=0, opts = {openImg: "tv-collapsable.gif", shutImg: "tv-expandable.gif", leafImg: "tv-item.gif", lastOpenImg: "tv-collapsable-last.gif", lastShutImg: "tv-expandable-last.gif", lastLeafImg: "tv-item-last.gif", vertLineImg: "vertline.gif", blankImg: "blank.gif", collapse: false, column: 0, striped: false, highlight: false, onselect: false}; jq.fn.jqTreeTable = function(map, options){ for (var i in opts){//Sort out the options opts[i] = (options[i])? options[i]: opts[i]; } for (var x=0,xl=map.length; x'; pref = preStr + ''; buildText(ro, pref); }else{//it's a child img = (y==yl-1)? opts.lastLeafImg: opts.leafImg;//It's the last child, It's child will have a blank field behind it mapb[ro-1] = preStr + ''; } } }; expandKids = function(num){//Expands immediate children jq("#r"+num).attr("src", function(){ return (this.src.substr(this.src.lastIndexOf("/")+1)==opts.lastShutImg)? opts.lastOpenImg: opts.openImg; }); for (var x=0, xl=mapa[num].length;x