最近調試EXTJS
使用treegrid
<link rel="stylesheet" type="text/css" href="css/ext
<script type="text/javascript" src="ext
<script type="text/javascript" src="treegrid
然後在頁面的body中寫上一個div
<div id="tree
以上官方就這麼寫的
記得把json數據文件和css文件等拷貝到調用目錄下
完成的treegrid
/*
This file is part of Ext JS
Copyright (c)
Contact:
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version
If you are unsure which license is appropriate for your use
*/
Ext
]);
Ext
//we want to setup a model and store instead of using dataUrl
Ext
extend:
fields: [
{name:
{name:
{name:
]
});
var store = Ext
model:
proxy: {
type:
//the store will get the content from the
url:
}
folderSort: true
});
//Ext
var tree = Ext
title:
width:
height:
renderTo:
collapsible: true
useArrows: true
rootVisible: false
store: store
multiSelect: true
singleExpand: true
//the
columns: [{
xtype:
text:
flex:
sortable: true
dataIndex:
}
//we must use the templateheader component so we can use a custom tpl
xtype:
text:
flex:
sortable: true
dataIndex:
align:
//add in the custom tpl for the rows
tpl: Ext
formatHours: function(v) {
if (v <
return Math
} else if (Math
var min = v
return Math
} else {
return v +
}
}
})
}
text:
flex:
dataIndex:
sortable: true
}]
});
});
From:http://tw.wingwit.com/Article/program/PHP/201311/21028.html