<script type="text/javascript">
Ext.onReady(function(){
var data=[[1,'name','age','sex'],[2,'tel','taller','www.iteye.com'],[3,'add','qq','email']]; //定义一个二维数组
var store = new Ext.data.SimpleStore({data:data,fields:['id','name','hody','homepage']}); //定义一个数据源
//创建三个列
var colM = new Ext.grid.ColumnModel([
{header:'person',dataIndex:'name',sortable:true}, //sortable为true,表示可以根据这列排序(升序或降序)
{header:'common',dataIndex:'hody',sortable:true},
{header:'other',dataIndex:'homepage',renderer:showUrl}
]);
var grid = new Ext.grid.GridPanel({
renderTo:'hello',
title:'example',
height:200,
width:600,
cm:colM, //指创建的那三个列
store:store,
autoExpandColumn:2
});
});
function showUrl(value){
return ""+value+"";
}
</script>
</head>
<body>
<div id="hello"></div>
</body>
</html>
Ext.onReady(function(){
var data=[[1,'name','age','sex'],[2,'tel','taller','www.iteye.com'],[3,'add','qq','email']]; //定义一个二维数组
var store = new Ext.data.SimpleStore({data:data,fields:['id','name','hody','homepage']}); //定义一个数据源
//创建三个列
var colM = new Ext.grid.ColumnModel([
{header:'person',dataIndex:'name',sortable:true}, //sortable为true,表示可以根据这列排序(升序或降序)
{header:'common',dataIndex:'hody',sortable:true},
{header:'other',dataIndex:'homepage',renderer:showUrl}
]);
var grid = new Ext.grid.GridPanel({
renderTo:'hello',
title:'example',
height:200,
width:600,
cm:colM, //指创建的那三个列
store:store,
autoExpandColumn:2
});
});
function showUrl(value){
return ""+value+"";
}
</script>
</head>
<body>
<div id="hello"></div>
</body>
</html>