EXTJS 4 樹形表格組件使用樣本,extjs樹形

來源:互聯網
上載者:User

EXTJS 4 樹形表格組件使用樣本,extjs樹形

EXTJS 4 樹形表格組件使用樣本一、整體

二、使用說明及2.1、程式碼及說明:2.1.1、表格儲存部分的代碼說明
//開啟tooltip工具    Ext.QuickTips.init();    //定義model    Ext.define('partModel', {        extend: 'Ext.data.Model',        fields: [            {name: 'partNo',   type: 'string'},            {name: 'partName', type: 'string'},            {name: 'partVer',  type: 'string'}        ]    });    //建立一個TreeStore    var store = Ext.create('Ext.data.TreeStore', {        model: 'partModel',        root:treeGridData, //在其他檔案中定義的靜態樹型資料         folderSort: true    });

屬性 說明
root

Ext.data.Model/Ext.data.NodeInterface/Object

根節點,當使用store是待用資料時,使用該屬性指定資料.若需要從伺服器上動態擷取,則可以使用proxy屬性

proxy屬性的使用可參見extjs 官方 api 

folderSort

Boolean 預設為 false

當設定為true時,葉子節點總是會在非葉子節點後面.

 treeGridData的具體內容請參見http://download.csdn.net/detail/shui878412/7994009

2.1.2、樹節點MODEL說明

TreeStore中使用了一個 Ext.data.NodeInterface來表示數的節點;在TreeStore的setRootNode方法中會調用NodeInterface的decorate方法向TreeStore的model增加一些屬性,這些屬性是在展示樹時必須使用的.這些屬性詳見如下:

名稱 類型 預設值 說明
parentId idType null 父節點ID,計算出來model中ID的類型
 index  int  null  可用於排序
 depth  int  0  
 expanded  bool  false  是否展開
 expandable  bool  false   是否可以展開
 checked  auto  null  
 leaf  bool  false  
 cls  string  null  樣式
 iconCls  string  null  表徵圖樣式
 icon  string  null  表徵圖路徑
 root  boolean  false  是否為根節點
 isLast  boolean  false  
 isFirst  boolean  false  
 allowDrop  boolean  true  是否可以被刪除
 allowDrag  boolean  true  是否可以被拖動
 loaded  boolean  false  
 loading  boolean  false  
 href  string  null  
 hrefTarget  string  null  
 qtip  string  null  tooltip內容
 qtitle  string  null  tooltip標題
 children  auto  null  子節點,一般是數組

 在有需要的時候可以設定這些屬性以達到我們想要的結果.如可以在store中通過指定icon/iconcls的值來設定樹節點中的圖片等.

2.1.3、表格顯示部分的代碼說明
var tree = Ext.create('Ext.tree.Panel', {    title: 'Ext樹型表格使用樣本',    width: 400,    height: 300,    renderTo: 'treeGridDiv',    useArrows: true,    rootVisible: false,    store: store,    multiSelect: true,    defaults:{        sortable: true    },    columns: [{        xtype: 'treecolumn',        text: '組件編號',        flex:2,        dataIndex: 'partNo'    },{        text: '組件名稱',        flex:1,        dataIndex: 'partName'    },{        text: '版本',        width: 70,        dataIndex: 'partVer'    }]});


屬性 說明
useArrows

Boolean 預設為false

true時使用箭頭()樣式,false是使用的是加號()樣式

rootVisible

Boolean 預設為true

是否顯示根節點

multiSelect

Boolean 預設為false

是否可以選中多行

 詳細代碼參見

http://download.csdn.net/detail/shui878412/7994009


有一個網址 上面都是extjs的單個組件的執行個體 比如表格等等,是什網址

docs.sencha.com/extjs/4.2.1/#!/example

就是extjs官方網站的例子麼
 
ExtJs 42 樹形菜單中超連結顯示有底線

百度找一找
 

聯繫我們

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