52,797
社区成员
发帖
与我相关
我的任务
分享
var jtbcs=new Ext.data.JsonStore({
autoLoad:true,
proxy:new Ext.data.HttpProxy({
method:'GET',
url:'Action/JKDA/grjkda_jktjb.aspx?type=listJtbcs'
}),
root:'rows',
totalProperty:'totalCount',
fields: [
{name: 'JCRQ1',mapping:'JCRQ1',type:'date'},//建床日期
{name: 'CCRQ1',mapping:'CCRQ1',type:'date'},//撤床日期
{name: 'YY',mapping:'YY'},//原因
{name: 'YLJGMC',mapping:'YLJGMC'},//医疗机构名称
{name: 'BAH',mapping:'BAH'}//病案号
]
});
var jtbcs=new Ext.data.JsonStore({
autoLoad:true,//这里有自动加载,下面就不需要reload了
proxy:new Ext.data.HttpProxy({
method:'GET',
url:'Action/JKDA/grjkda_jktjb.aspx?type=listJtbcs'
}),
reader:new Ext.data.JsonReader({
root:'rows',
totalProperty:'totalCount',
fields: [
{name: 'JCRQ1',mapping:'JCRQ1',type:'date'},//建床日期
{name: 'CCRQ1',mapping:'CCRQ1',type:'date'},//撤床日期
{name: 'YY',mapping:'YY'},//原因
{name: 'YLJGMC',mapping:'YLJGMC'},//医疗机构名称
{name: 'BAH',mapping:'BAH'}//病案号
]
})
});
grid的声明:
var jtbcsgrid = new Ext.grid.EditorGridPanel({
autoEncode:true,
store:jtbcs,
frame:true,
width:600,
height:200,
anchor:'93%',
clicksToEdit:1,
columns: [
{header: "建床日期", width: 100, sortable: true, dataIndex:"JCRQ1",renderer:dateRender, editor:new Ext.grid.GridEditor(new Ext.form.DateField({format:'Y-m-d',allowBlank:true}))},
{header: "撤床日期", width: 100, sortable: true,dataIndex:"CCRQ1",renderer:dateRender,editor:new Ext.grid.GridEditor(new Ext.form.DateField({format:'Y-m-d',allowBlank:true}))},
{header: "原因", width: 150, sortable: true,dataIndex:"YY",editor:new Ext.grid.GridEditor(new Ext.form.TextField({allowBlank:true}))},
{header: "医疗机构", width: 150, sortable: true,dataIndex:"YLJGMC",editor:new Ext.grid.GridEditor(new Ext.form.TextField({allowBlank:true}))},
{header: "病案号", width: 100, sortable: true,dataIndex:"BAH",editor:new Ext.grid.GridEditor(new Ext.form.TextField({allowBlank:true}))}
],
//store:jtbcs,上面有了store,这里不要
stripeRows: true
});
重载store:
jtbcs.reload({callback:function(){alert(this.getTotalCount())}}); 返回值为0
把你的json字符串拿到firebug下运行了,发现有换行符号。这个要去掉,在输出json字符串的时候
不要带ln这种输出。如:println/writeln 应该用print/write