1 //<Script type="text/javascript">
5 * Copyright(c) 2006-2007, Ext JS, LLC.
7 * Originally Released Under LGPL - original licence link has changed is not relivant.
10 * <script type="text/javascript">
14 * Not documented??? - probably should be...
17 Roo.tree.ColumnNodeUI = Roo.extend(Roo.tree.TreeNodeUI, {
18 //focus: Roo.emptyFn, // prevent odd scrolling behavior
20 renderElements : function(n, a, targetNode, bulkRender){
21 //consel.log("renderElements?");
22 this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
24 var t = n.getOwnerTree();
25 var tid = Pman.Tab.Document_TypesTree.tree.el.id;
28 var bw = t.borderWidth;
30 var href = a.href ? a.href : Roo.isGecko ? "" : "#";
31 var cb = typeof a.checked == "boolean";
32 var tx = String.format('{0}',n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]));
33 var colcls = 'x-t-' + tid + '-c0';
35 '<li class="x-tree-node">',
38 '<div class="x-tree-node-el ', a.cls,'">',
40 '<div class="x-tree-col ', colcls, '" style="width:', c.width-bw, 'px;">',
43 '<span class="x-tree-node-indent">',this.indentMarkup,'</span>',
44 '<img src="', this.emptyIcon, '" class="x-tree-ec-icon " />',
45 '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',
46 (a.icon ? ' x-tree-node-inline-icon' : ''),
47 (a.iconCls ? ' '+a.iconCls : ''),
48 '" unselectable="on" />',
49 (cb ? ('<input class="x-tree-node-cb" type="checkbox" ' +
50 (a.checked ? 'checked="checked" />' : ' />')) : ''),
52 '<a class="x-tree-node-anchor" hidefocus="on" href="',href,'" tabIndex="1" ',
53 (a.hrefTarget ? ' target="' +a.hrefTarget + '"' : ''), '>',
54 '<span unselectable="on" qtip="' + tx + '">',
58 '<a class="x-tree-node-anchor" hidefocus="on" href="',href,'" tabIndex="1" ',
59 (a.hrefTarget ? ' target="' +a.hrefTarget + '"' : ''), '>',
62 for(var i = 1, len = cols.length; i < len; i++){
64 colcls = 'x-t-' + tid + '-c' +i;
65 tx = String.format('{0}', (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]));
66 buf.push('<div class="x-tree-col ', colcls, ' ' ,(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
67 '<div class="x-tree-col-text" qtip="' + tx +'">',tx,"</div>",
73 '<div class="x-clear"></div></div>',
74 '<ul class="x-tree-node-ct" style="display:none;"></ul>',
77 if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
78 this.wrap = Roo.DomHelper.insertHtml("beforeBegin",
79 n.nextSibling.ui.getEl(), buf.join(""));
81 this.wrap = Roo.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
83 var el = this.wrap.firstChild;
85 this.elNode = el.firstChild;
86 this.ranchor = el.childNodes[1];
87 this.ctNode = this.wrap.childNodes[1];
88 var cs = el.firstChild.childNodes;
89 this.indentNode = cs[0];
91 this.iconNode = cs[2];
94 this.checkbox = cs[3];
97 this.anchor = cs[index];
99 this.textNode = cs[index].firstChild;
101 //el.on("click", this.onClick, this);
102 //el.on("dblclick", this.onDblClick, this);
105 // console.log(this);
107 initEvents : function(){
108 Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);
111 var a = this.ranchor;
115 if(Roo.isOpera){ // opera render bug ignores the CSS
116 el.setStyle("text-decoration", "none");
119 el.on("click", this.onClick, this);
120 el.on("dblclick", this.onDblClick, this);
121 el.on("contextmenu", this.onContextMenu, this);
125 /*onSelectedChange : function(state){
128 this.addClass("x-tree-selected");
131 this.removeClass("x-tree-selected");
134 addClass : function(cls){
136 Roo.fly(this.elRow).addClass(cls);
142 removeClass : function(cls){
144 Roo.fly(this.elRow).removeClass(cls);