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 + '"' : ''), '>'
61 for(var i = 1, len = cols.length; i < len; i++){
63 colcls = 'x-t-' + tid + '-c' +i;
64 tx = String.format('{0}', (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]));
65 buf.push('<div class="x-tree-col ', colcls, ' ' ,(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
66 '<div class="x-tree-col-text" qtip="' + tx +'">',tx,"</div>",
72 '<div class="x-clear"></div></div>',
73 '<ul class="x-tree-node-ct" style="display:none;"></ul>',
76 if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
77 this.wrap = Roo.DomHelper.insertHtml("beforeBegin",
78 n.nextSibling.ui.getEl(), buf.join(""));
80 this.wrap = Roo.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
82 var el = this.wrap.firstChild;
84 this.elNode = el.firstChild;
85 this.ranchor = el.childNodes[1];
86 this.ctNode = this.wrap.childNodes[1];
87 var cs = el.firstChild.childNodes;
88 this.indentNode = cs[0];
90 this.iconNode = cs[2];
93 this.checkbox = cs[3];
96 this.anchor = cs[index];
98 this.textNode = cs[index].firstChild;
100 //el.on("click", this.onClick, this);
101 //el.on("dblclick", this.onDblClick, this);
104 // console.log(this);
106 initEvents : function(){
107 Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);
110 var a = this.ranchor;
114 if(Roo.isOpera){ // opera render bug ignores the CSS
115 el.setStyle("text-decoration", "none");
118 el.on("click", this.onClick, this);
119 el.on("dblclick", this.onDblClick, this);
120 el.on("contextmenu", this.onContextMenu, this);
124 /*onSelectedChange : function(state){
127 this.addClass("x-tree-selected");
130 this.removeClass("x-tree-selected");
133 addClass : function(cls){
135 Roo.fly(this.elRow).addClass(cls);
141 removeClass : function(cls){
143 Roo.fly(this.elRow).removeClass(cls);