惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - EricZhen

【ExtJS实践】之七 :禁止Grid、Treegrid列排序和列菜单 【ExtJS实践】之六 :Combobox从后台获取JSON格式的数据 【ExtJS实践】之五 :常用语句及脚本备忘 【ExtJS实践】之四 :关于ExtJS的createDelegate 【ExtJS实践】之三 :页面布局应用 【ExtJS实践】之一 :TreeGrid异步加载数据 ASP.Net下使用ExtJS报“Ext未定义”错误的原因 关于在Windows2008里配置AjaxPro.2 【备忘】转:.net的数据库连接字符串 【备忘】转:模态窗口缓存问题的解决 【备忘】红旗Linux下安装VMWare Tools的方法 关于Cookie的一个小问题 [备忘]各类数据库连接字符串 [备忘]autorun专杀工具 [备忘].cll文件的MIME类型 [备忘]方正字库中英文对照表 [SharePoint2007]使用自定义数据库的几个问题 [SharePoint]不同页面间的多个数据视图间建立关联 C#在Word文档指定位置处理表格
【ExtJS实践】之二 :TreeGrid显示复选框
EricZhen · 2012-06-11 · via 博客园 - EricZhen
  1 /*!
  2  * Ext JS Library 3.4
  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 
 14     renderElements : function(n, a, targetNode, bulkRender){
 15         var t = n.getOwnerTree(),
 16             cols = t.columns,
 17             c = cols[0],
 18             i, buf, len;
 19 
 20         this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
 21 
 22     var cb = Ext.isBoolean(a.checked);
 23         buf = [
 24              '<tbody class="x-tree-node">',
 25                 '<tr ext:tree-node-id="', n.id ,'" class="x-tree-node-el x-tree-node-leaf ', a.cls, '">',
 26                     '<td class="x-treegrid-col">',
 27                         '<span class="x-tree-node-indent">', this.indentMarkup, "</span>",
 28                         '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
 29                         '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon', (a.icon ? " x-tree-node-inline-icon" : ""), (a.iconCls ? " "+a.iconCls : ""), '" unselectable="on" />',
 30             cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
 31                         '<a hidefocus="on" class="x-tree-node-anchor" href="', a.href ? a.href : '#', '" tabIndex="1" ',
 32                             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : '', '>',
 33                         '<span unselectable="on">',
 34             (c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text),
 35             '</span></a>',
 36                     '</td>'
 37         ];
 38 
 39         for(i = 1, len = cols.length; i < len; i++){
 40             c = cols[i];
 41             buf.push(
 42                     '<td class="x-treegrid-col ', (c.cls ? c.cls : ''), '">',
 43                         '<div unselectable="on" class="x-treegrid-text"', (c.align ? ' style="text-align: ' + c.align + ';"' : ''), '>',
 44                             (c.tpl ? c.tpl.apply(a) : a[c.dataIndex]),
 45                         '</div>',
 46                     '</td>'
 47             );
 48         }
 49 
 50         buf.push(
 51             '</tr><tr class="x-tree-node-ct"><td colspan="', cols.length, '">',
 52             '<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ', t.innerCt.getWidth() ,'px;"><colgroup>'
 53         );
 54         for(i = 0, len = cols.length; i<len; i++) {
 55             buf.push('<col style="width: ', (cols[i].hidden ? 0 : cols[i].width) ,'px;" />');
 56         }
 57         buf.push('</colgroup></table></td></tr></tbody>');
 58 
 59         if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
 60             this.wrap = Ext.DomHelper.insertHtml("beforeBegin", n.nextSibling.ui.getEl(), buf.join(''));
 61         }else{
 62             this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(''));
 63         }
 64 
 65         this.elNode = this.wrap.childNodes[0];
 66         this.ctNode = this.wrap.childNodes[1].firstChild.firstChild;
 67         var cs = this.elNode.firstChild.childNodes;
 68 
 69         this.indentNode = cs[0];
 70         this.ecNode = cs[1];
 71         this.iconNode = cs[2];
 72 
 73     if (cb) {
 74       this.checkbox = cs[3];
 75       this.anchor = cs[4];
 76       this.textNode = cs[4].firstChild;
 77     } else {
 78       this.anchor = cs[3];
 79       this.textNode = cs[3].firstChild;
 80     }
 81     },
 82 
 83     // private
 84     animExpand : function(cb){
 85         this.ctNode.style.display = "";
 86         Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this, cb);
 87     }
 88 });
 89 
 90 Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
 91     isTreeGridNodeUI: true,
 92 
 93     // private
 94     render : function(){
 95         if(!this.rendered){
 96             this.wrap = this.ctNode = this.node.ownerTree.innerCt.dom;
 97             this.node.expanded = true;
 98         }
 99 
100         if(Ext.isWebKit) {
101             // weird table-layout: fixed issue in webkit
102             var ct = this.ctNode;
103             ct.style.tableLayout = null;
104             (function() {
105                 ct.style.tableLayout = 'fixed';
106             }).defer(1);
107         }
108     },
109 
110     destroy : function(){
111         if(this.elNode){
112             Ext.dd.Registry.unregister(this.elNode.id);
113         }
114         delete this.node;
115     },
116 
117     collapse : Ext.emptyFn,
118     expand : Ext.emptyFn
119 });