Ext.define('S3.Console.HealthReport1', {
constructor: function () { var startDate = Ext.create('Ext.form.field.Date', {
fieldLabel: '开始时间',
format: 'Y/m/d',
editable: false,
value: Ext.Date.add(new Date(), Ext.Date.DAY, -7),
labelWidth: 80,
width: 200
}); var endDate = Ext.create('Ext.form.field.Date', {
fieldLabel: '结束时间',
format: 'Y/m/d',
editable: false,
value: new Date(),
labelWidth: 80,
width: 200
}); var store = new Ext.data.JsonStore({
root: 'data'
});
var grid = Ext.grid.GridPanel({
height: 350,
width: 600,
data:store
});
var panel = Ext.create('Ext.panel.Panel', {
width: 600,
height: 500,
layout: {
type: 'fit',
columns: 1
},
items: grid,
buttons: [
{ text: '立即体检',
width: 150,
height: 50,
handler: function () { Ext.Ajax.request({
url: 'core/WebService.asmx/ColdStorage',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
method: 'POST',
jsonData: {
startTime: Ext.Date.format(startDate.getValue(), 'Y-m-d'),
endTime: Ext.Date.format(endDate.getValue(), 'Y-m-d') + ' 23:59:59.999',
dept_id: "0002"
},
success: function (response) {
var responseJson = Ext.JSON.decode(response.responseText);
store.loadData(responseJson);
// Ext.Msg.alert("dsd");
},
failure: function () { Ext.Msg.alert("错误"); } }); }
}
] });
var win = new Ext.create('Ext.Window', {
title: '报表',
height: 500,
width: 600,
layout: 'fit',
tbar: [startDate, endDate],
items: panel
}) win.show();
}});
constructor: function () { var startDate = Ext.create('Ext.form.field.Date', {
fieldLabel: '开始时间',
format: 'Y/m/d',
editable: false,
value: Ext.Date.add(new Date(), Ext.Date.DAY, -7),
labelWidth: 80,
width: 200
}); var endDate = Ext.create('Ext.form.field.Date', {
fieldLabel: '结束时间',
format: 'Y/m/d',
editable: false,
value: new Date(),
labelWidth: 80,
width: 200
}); var store = new Ext.data.JsonStore({
root: 'data'
});
var grid = Ext.grid.GridPanel({
height: 350,
width: 600,
data:store
});
var panel = Ext.create('Ext.panel.Panel', {
width: 600,
height: 500,
layout: {
type: 'fit',
columns: 1
},
items: grid,
buttons: [
{ text: '立即体检',
width: 150,
height: 50,
handler: function () { Ext.Ajax.request({
url: 'core/WebService.asmx/ColdStorage',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
method: 'POST',
jsonData: {
startTime: Ext.Date.format(startDate.getValue(), 'Y-m-d'),
endTime: Ext.Date.format(endDate.getValue(), 'Y-m-d') + ' 23:59:59.999',
dept_id: "0002"
},
success: function (response) {
var responseJson = Ext.JSON.decode(response.responseText);
store.loadData(responseJson);
// Ext.Msg.alert("dsd");
},
failure: function () { Ext.Msg.alert("错误"); } }); }
}
] });
var win = new Ext.create('Ext.Window', {
title: '报表',
height: 500,
width: 600,
layout: 'fit',
tbar: [startDate, endDate],
items: panel
}) win.show();
}});
root: 'data'
});估计你的grid里已经能看到空行了,但没文字
store如果没有fields,就不知道该从jsonData里读哪些属性,
比如指定了fields有 id,name, 才会从一堆json里读取 id,name值 到store里