ext 表格问题
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/jquery-1.8.0.js" type="text/javascript"></script>
<script src="js/jquery-1.8.0-vsdoc.js" type="text/javascript"></script>
<script src="adapter/ext/ext-base.js" type="text/javascript"></script>
<link href="resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="ext-all.js" type="text/javascript"></script>
<script type ="text/javascript" language=javascript>
Ext.onReady(function () {
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel([
sm,
//定义表格
{header: '学号', dataIndex: 'id', width: 60, sortable: true },
{header:'姓名', dataIndex: 'name', width: 120},
{header:'性别',dataIndex:'sex',width:60},
{header:'年龄',dataIndex:'age',width:60},
{header:'班级',dataIndex:'class',width:60}
]);
function renderSex(value){
if(value=='male'){
return "<span style='color:red;font-weight:bold;'>红男</span>";
}else{
return"<span style='color:green;font-weight:bold;'>绿女</span>";
}
}
var data=[
['1001','韩迪','M','20','软1'],
['1002','李平','F','19','软2'],
['1003','杨那','F','20','软1'],
['1004','郑超','M','21','软2'],
['1005','吴静','F','20','软1'],
];//二维数组
var store = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({}, [
{ name: 'id'},
{ name: 'name'},
{ name: 'sex'},
{ name: 'age'},
{ name: 'class'}
])
});
store.load();//初始化数据
});
</script>
</head>
<body>
<div id ='grid'></div>
</body>
</html> 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/jquery-1.8.0.js" type="text/javascript"></script>
<script src="js/jquery-1.8.0-vsdoc.js" type="text/javascript"></script>
<script src="adapter/ext/ext-base.js" type="text/javascript"></script>
<link href="resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="ext-all.js" type="text/javascript"></script>
<script type ="text/javascript" language=javascript>
Ext.onReady(function () {
var sm=new Ext.grid.CheckboxSelectionModel();
var cm = new Ext.grid.ColumnModel([
sm,
//定义表格
{header: '学号', dataIndex: 'id', width: 60, sortable: true },
{header:'姓名', dataIndex: 'name', width: 120},
{header:'性别',dataIndex:'sex',width:60},
{header:'年龄',dataIndex:'age',width:60},
{header:'班级',dataIndex:'class',width:60}
]);
function renderSex(value){
if(value=='male'){
return "<span style='color:red;font-weight:bold;'>红男</span>";
}else{
return"<span style='color:green;font-weight:bold;'>绿女</span>";
}
}
var data=[
['1001','韩迪','M','20','软1'],
['1002','李平','F','19','软2'],
['1003','杨那','F','20','软1'],
['1004','郑超','M','21','软2'],
['1005','吴静','F','20','软1'],
];//二维数组
var store = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({}, [
{ name: 'id'},
{ name: 'name'},
{ name: 'sex'},
{ name: 'age'},
{ name: 'class'}
])
});
store.load();//初始化数据
});
</script>
</head>
<body>
<div id ='grid'></div>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询