为什么用HttpProxy,JsonReader取不到后台的数据:
Ext.onReady(function(){varworkLoad_store=newExt.data.Store({proxy:newExt.data.HttpPro...
Ext.onReady(function () {
var workLoad_store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
method: 'GET',
url: 'http://localhost:3182/WebForm2.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'chartdata',
fields: ['AdSiteName', 'ClickCount']
}),
autoLoad: true
});
new Ext.Panel({
iconCls: 'chart',
title: ' Advertisement Click Statistics',
frame: true,
renderTo: 'workLoadContainer',
width: 1000,
height: 300,
layout: 'fit',
items: {
xtype: 'columnchart',
store: workLoad_store,
// url: '/chart/charts.swf',
xField: 'AdSiteName',
yAxis: new Ext.chart.NumericAxis({
displayName: 'Visits',
labelRenderer: Ext.util.Format.numberRenderer('0,0')
}),
series: [{
type: 'column',
displayName: 'ClickCount',
yField: 'ClickCount',
style: {
mode: 'stretch',
color: 0x99BBE8
}
}]
}
});
})
以下是WebForm2的后台代码:
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Response.Write("{chartdata:[{AdSiteName:'Google',ClickCount:10000},{AdSiteName:'Mircrosoft',ClickCount:5000}]}");
}
}
各位大哥,救救小妹吧 展开
var workLoad_store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
method: 'GET',
url: 'http://localhost:3182/WebForm2.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'chartdata',
fields: ['AdSiteName', 'ClickCount']
}),
autoLoad: true
});
new Ext.Panel({
iconCls: 'chart',
title: ' Advertisement Click Statistics',
frame: true,
renderTo: 'workLoadContainer',
width: 1000,
height: 300,
layout: 'fit',
items: {
xtype: 'columnchart',
store: workLoad_store,
// url: '/chart/charts.swf',
xField: 'AdSiteName',
yAxis: new Ext.chart.NumericAxis({
displayName: 'Visits',
labelRenderer: Ext.util.Format.numberRenderer('0,0')
}),
series: [{
type: 'column',
displayName: 'ClickCount',
yField: 'ClickCount',
style: {
mode: 'stretch',
color: 0x99BBE8
}
}]
}
});
})
以下是WebForm2的后台代码:
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Response.Write("{chartdata:[{AdSiteName:'Google',ClickCount:10000},{AdSiteName:'Mircrosoft',ClickCount:5000}]}");
}
}
各位大哥,救救小妹吧 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询