ExtJS4.0.7 樹組建treePanel簡單介紹

來源:互聯網
上載者:User
ExtJS4 樹組件 Tree Ext.tree.Panel       Ext.data.Tree Ext.data.NodeInterface Ext.data.TreeStore Ext.tree.View

         相關的類有Panel,Tree, NodeInterface,TreeStore,View。從treePanel看起,treePanel主要提供樹結構資料的UI展現。一個TreePanel必須綁定一個TreeStore。TreePanel支援通過列配置多個列。

樹節點NodeInterface 提供配置項: allowDrag:是否允許拖拽expandable:是否允許摺疊expanded:是否展開leaf:是否是葉子isFirst:isLast:loaded:loading:root:根text:文本……


//樹節點配置[root>>children]每個節點有: text顯示文本, leaf是否是葉子, expanded是否展開,等屬性。var store = Ext.create('Ext.data.TreeStore', {    root: {        expanded: true,        children: [            { text: "detention", leaf: true },            { text: "homework", expanded: true, children: [                { text: "book", leaf: true },                { text: "alegrbra", leaf: true}            ] },            { text: "tickets", leaf: true }        ]    }});//建立TreePanel rootVisible表示根節點是否顯示Ext.create('Ext.tree.Panel', {    title: 'Simple Tree',    width: 200,    height: 150,    store: store,    rootVisible: false,    renderTo: Ext.getBody()});

//不需要每個參數一一解釋,要注意的是每個參數都有一個預設值,沒有明確配置的時候,使用的是預設值。//樹節點的Itemclick事件lExt.create('Ext.tree.Panel', {    title: 'Simple Tree',    width: 200,    height: 150,    store: store,    rootVisible: false,    listeners: {itemclick:function(view,record,item,index,e,eOpts){                  // 從record item index 等參數中我們可以獲得大部分滿足我們應用的資訊               if(record.get('text')=='book'){// do somethings……};               if(record.get('text')=='detetion'){//do something……}        }    }    renderTo: Ext.getBody()});





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.