我用EXTjs写了一个表格面板,就是数据一直读不出来,高手帮忙看看,解决给30分,下面是代码及显示页面
Ext.onReady(function(){varcm=newExt.grid.ColumnModel([{header:"姓名",width:80,dataIndex...
Ext.onReady(function(){
var cm=new Ext.grid.ColumnModel([
{header:"姓名",width:80,dataIndex:"Name"},
{header:"性别",width:40,dataIndex:"Sex"},
{header:"生日",width:150,format:"Y-m-d",dataIndex:"Birthday"},
{header:"学历",width:80,dataIndex:"Education"},
{id:"mm",header:"备注",dataIndex:"Memo"}
]);
//准备数据
var MYdata=[{
Name:"李赞红",
Sex:"女",
Birthday:Date.parseDate("1979-04-11","Y-m-d"),
Education:"本科",
Memo:"无备注"
}];
var MYproxy=new Ext.data.MemoryProxy(MYdata);
var Human=Ext.data.Record.create([
{nam:"Name",type:"string",mapping:"Name"},
{nam:"Sex",type:"string",mapping:"Sex"},
{nam:"Birthday",type:"string",mapping:"Birthday"},
{nam:"Education",type:"string",mapping:"Education"},
{nam:"Memo",type:"string",mapping:"Memo"}
]);
var MYreader=new Ext.data.JsonReader({},Human);
var store=new Ext.data.Store({
proxy:MYproxy,
reader:MYreader,
autoLoad:true
});
var grid=new Ext.grid.GridPanel({
title:"中国公民",
width:600,
autoHeight:true,
cm:cm,
store:store,
autoExtpandColumn:"mm",
renderTo:Ext.getBody()
});
}); 展开
var cm=new Ext.grid.ColumnModel([
{header:"姓名",width:80,dataIndex:"Name"},
{header:"性别",width:40,dataIndex:"Sex"},
{header:"生日",width:150,format:"Y-m-d",dataIndex:"Birthday"},
{header:"学历",width:80,dataIndex:"Education"},
{id:"mm",header:"备注",dataIndex:"Memo"}
]);
//准备数据
var MYdata=[{
Name:"李赞红",
Sex:"女",
Birthday:Date.parseDate("1979-04-11","Y-m-d"),
Education:"本科",
Memo:"无备注"
}];
var MYproxy=new Ext.data.MemoryProxy(MYdata);
var Human=Ext.data.Record.create([
{nam:"Name",type:"string",mapping:"Name"},
{nam:"Sex",type:"string",mapping:"Sex"},
{nam:"Birthday",type:"string",mapping:"Birthday"},
{nam:"Education",type:"string",mapping:"Education"},
{nam:"Memo",type:"string",mapping:"Memo"}
]);
var MYreader=new Ext.data.JsonReader({},Human);
var store=new Ext.data.Store({
proxy:MYproxy,
reader:MYreader,
autoLoad:true
});
var grid=new Ext.grid.GridPanel({
title:"中国公民",
width:600,
autoHeight:true,
cm:cm,
store:store,
autoExtpandColumn:"mm",
renderTo:Ext.getBody()
});
}); 展开
1个回答
展开全部
var Human=Ext.data.Record.create([
// 这里name写成nam了
{nam:"Name",type:"string",mapping:"Name"},
{nam:"Sex",type:"string",mapping:"Sex"},
{nam:"Birthday",type:"string",mapping:"Birthday"},
{nam:"Education",type:"string",mapping:"Education"},
{nam:"Memo",type:"string",mapping:"Memo"}
]);
追问
谢了,确实是,找半天。愣是没发现,分给你
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询