Extjs 樹節點樣式改變

來源:互聯網
上載者:User

標籤:des   style   blog   color   io   ar   div   sp   cti   

ExtJs 中預設對樹節點表徵圖控制的CSS代碼:

1 .x-tree-icon-leaf{width:16px;background-image:url(‘../../resources/themes/images/default/tree/leaf.gif‘)}2 .x-tree-icon-parent{width:16px;background-image:url(‘../../resources/themes/images/default/tree/folder.gif‘)}3 .x-grid-tree-node-expanded .x-tree-icon-parent{background-image:url(‘../../resources/themes/images/default/tree/folder-open.gif‘)}

對樹節點的表徵圖的改變:

1、擷取樹節點

    可以在後台先列印出來節點

    

var store = Ext.create(‘Ext.data.TreeStore‘, {    root: {        id : ‘root‘ ,        text : ‘我的tree‘ ,        expanded: true,        //這個children是一個數組        children: [            {            id : ‘c1‘ ,            text: "1",             expanded: true,                 children: [                      {id : ‘c1‘ ,text: "11", leaf: true },                      {id : ‘c2‘ , text: "22", leaf: true}                      ] },            {            id : ‘c2‘ ,            text: "2",            expanded: true,                 children: [                      {id : ‘c3‘ ,  text: "33", leaf: true },                      {id : ‘c4‘ , text: "44", leaf: true}                      ] },           {           id : ‘c3‘ ,           text: "3",           expanded: true,                children: [                      {id : ‘5‘ ,  text: "55", leaf: true },                      {id : ‘6‘ , text: "66", leaf: true}                      ]}        ]    }});var testTree = Ext.create(‘Ext.tree.Panel‘, {    title: ‘導航樹‘,    width: 200,    height: 800,    store: store,             rootVisible: true,    lines : true ,  //設定lines為false, TreePanel將會隱藏折線.    useArrows : false , //隱藏折線,並且顯示出一個箭頭表徵圖.//    iconcls :      renderTo : Ext.getBody()});
if(message.type == ‘change_icon‘){                            // testTree .settreeCls(‘user-online‘);                        //var rootNode = treestore.getRootNode();                         //var root = rootNode.childNodes;                        //console.log(testTree.getRootNode().get(‘id‘));                        //console.log(testTree.id);                        //console.log(testTree);                        //console.log(testTree);                                /*                        testTree                            testTree.setIconCls(‘user-online‘);*/                        }
/**  * treeNode ext TreeNode對象  * oldIconCls 原表徵圖css名  * newIconCls 新表徵圖css名  */ function updateTreeNodeIcon(treeNode,oldIconCls,newIconCls){      if(!treeNode)           return;          /*獲得樹節點<Img> html頁面元素對象*/       var imgHtmlEl = treeNode.getUI().getIconEl();       /*設定樹節點新表徵圖css*/      treeNode.iconCls = newIconCls;      Ext.Element.fly(imgHtmlEl).removeClass(oldIconCls);// @1      Ext.Element.fly(imgHtmlEl).addClass(newIconCls); }

 

Extjs 樹節點樣式改變

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.