Installer/Updater
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. /**
  8. * @class Ext.ux.tree.TreeGridNodeUI
  9. * @extends Ext.tree.TreeNodeUI
  10. */
  11. Ext.ux.tree.TreeGridNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
  12. isTreeGridNodeUI: true,
  13. renderElements : function(n, a, targetNode, bulkRender){
  14. var t = n.getOwnerTree(),
  15. cols = t.columns,
  16. c = cols[0],
  17. i, buf, len;
  18. this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
  19. buf = [
  20. '<tbody class="x-tree-node">',
  21. '<tr ext:tree-node-id="', n.id ,'" class="x-tree-node-el x-tree-node-leaf ', a.cls, '">',
  22. '<td class="x-treegrid-col">',
  23. '<span class="x-tree-node-indent">', this.indentMarkup, "</span>",
  24. '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
  25. '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon', (a.icon ? " x-tree-node-inline-icon" : ""), (a.iconCls ? " "+a.iconCls : ""), '" unselectable="on" />',
  26. '<a hidefocus="on" class="x-tree-node-anchor" href="', a.href ? a.href : '#', '" tabIndex="1" ',
  27. a.hrefTarget ? ' target="'+a.hrefTarget+'"' : '', '>',
  28. '<span unselectable="on">', (c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text), '</span></a>',
  29. '</td>'
  30. ];
  31. for(i = 1, len = cols.length; i < len; i++){
  32. c = cols[i];
  33. buf.push(
  34. '<td class="x-treegrid-col ', (c.cls ? c.cls : ''), '">',
  35. '<div unselectable="on" class="x-treegrid-text"', (c.align ? ' style="text-align: ' + c.align + ';"' : ''), '>',
  36. (c.tpl ? c.tpl.apply(a) : a[c.dataIndex]),
  37. '</div>',
  38. '</td>'
  39. );
  40. }
  41. buf.push(
  42. '</tr><tr class="x-tree-node-ct"><td colspan="', cols.length, '">',
  43. '<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ', t.innerCt.getWidth() ,'px;"><colgroup>'
  44. );
  45. for(i = 0, len = cols.length; i<len; i++) {
  46. buf.push('<col style="width: ', (cols[i].hidden ? 0 : cols[i].width) ,'px;" />');
  47. }
  48. buf.push('</colgroup></table></td></tr></tbody>');
  49. if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
  50. this.wrap = Ext.DomHelper.insertHtml("beforeBegin", n.nextSibling.ui.getEl(), buf.join(''));
  51. }else{
  52. this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(''));
  53. }
  54. this.elNode = this.wrap.childNodes[0];
  55. this.ctNode = this.wrap.childNodes[1].firstChild.firstChild;
  56. var cs = this.elNode.firstChild.childNodes;
  57. this.indentNode = cs[0];
  58. this.ecNode = cs[1];
  59. this.iconNode = cs[2];
  60. this.anchor = cs[3];
  61. this.textNode = cs[3].firstChild;
  62. },
  63. // private
  64. animExpand : function(cb){
  65. this.ctNode.style.display = "";
  66. Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this, cb);
  67. }
  68. });
  69. Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
  70. isTreeGridNodeUI: true,
  71. // private
  72. render : function(){
  73. if(!this.rendered){
  74. this.wrap = this.ctNode = this.node.ownerTree.innerCt.dom;
  75. this.node.expanded = true;
  76. }
  77. if(Ext.isWebKit) {
  78. // weird table-layout: fixed issue in webkit
  79. var ct = this.ctNode;
  80. ct.style.tableLayout = null;
  81. (function() {
  82. ct.style.tableLayout = 'fixed';
  83. }).defer(1);
  84. }
  85. },
  86. destroy : function(){
  87. if(this.elNode){
  88. Ext.dd.Registry.unregister(this.elNode.id);
  89. }
  90. delete this.node;
  91. },
  92. collapse : Ext.emptyFn,
  93. expand : Ext.emptyFn
  94. });