ExtJS前台读取后台数据的问题
--------------------前台Ext.onReady(function(){varcum=newExt.grid.ColumnModel([{header:...
--------------------前台
Ext.onReady
(
function()
{
var cum=new Ext.grid.ColumnModel
(
[
{header:'层次编号',dataIndex:'LAYERNO'},
{header:'分层类型',dataIndex:'LAYERTYPE'},
{header:'帐户机构号',dataIndex:'ACTORG'},
{header:'人数',dataIndex:'CUSTOMERNO'},
{header:'有效比例',dataIndex:'AVILBL'},
{header:'总金额',dataIndex:'SUMBAL'}
]
);
var myproxy=new Ext.data.HttpProxy
(
{
url:"shit.jsp"
}
);
var myreader=new Ext.data.JsonReader
(
{
totalProperty:'totalProperty',
root:'root'
},
[
{name:'LAYERNO'},
{name:'LAYERTYPE'},
{name:'ACTORG'},
{name:'CUSTOMERNO'},
{name:'AVILBL'},
{name:'SUMBAL'}
]
);
var busnieStore=new Ext.data.Store
(
{
proxy:myproxy,
reader:myreader,
listeners :
{
'loadexception' : function()
{
alert('exception');
},
'beforeload' : function(store, options)
{
mst=Ext.MessageBox.show
(
{
title:'test',
width:250,
msg:'before....'
}
)
},
'load' : function()
{
alert("load")
mst.hide()
}
},
callback:function(r,options,success)
{
alert('2')
if(success)
{
alert("1")
var recordds=new Array();
for(var i=0;i<r.length;i++)
{
alert(r[i].data.caPk);
};
}
}
}
);
var grid=new Ext.grid.GridPanel
(
{
height : 300,
cm:cum,
layout : 'form',
region:'center',
id:'grid',
store:busnieStore,
renderTo:'cbt',
viewConfig:
{
forceFit:true
}
}
);
busnieStore.load();
}
)
---------后台
<%
System.out.println("kaishi.....");
try
{
String JSONStr="{totalProperty:1,root:[{ACTORG:'15601',LAYERTYPE:'0余额',AVILBL:'0',LAYERNO:'0',CUSTOMERNO:'9394',SUMBAL:'0'}]}";
response.getWriter().write(JSONStr);
}
catch(Exception e)
{
}
%>
谁能帮我看一下,前台读取后台数据,为什么显示不出来,跪求,看了一天了 展开
Ext.onReady
(
function()
{
var cum=new Ext.grid.ColumnModel
(
[
{header:'层次编号',dataIndex:'LAYERNO'},
{header:'分层类型',dataIndex:'LAYERTYPE'},
{header:'帐户机构号',dataIndex:'ACTORG'},
{header:'人数',dataIndex:'CUSTOMERNO'},
{header:'有效比例',dataIndex:'AVILBL'},
{header:'总金额',dataIndex:'SUMBAL'}
]
);
var myproxy=new Ext.data.HttpProxy
(
{
url:"shit.jsp"
}
);
var myreader=new Ext.data.JsonReader
(
{
totalProperty:'totalProperty',
root:'root'
},
[
{name:'LAYERNO'},
{name:'LAYERTYPE'},
{name:'ACTORG'},
{name:'CUSTOMERNO'},
{name:'AVILBL'},
{name:'SUMBAL'}
]
);
var busnieStore=new Ext.data.Store
(
{
proxy:myproxy,
reader:myreader,
listeners :
{
'loadexception' : function()
{
alert('exception');
},
'beforeload' : function(store, options)
{
mst=Ext.MessageBox.show
(
{
title:'test',
width:250,
msg:'before....'
}
)
},
'load' : function()
{
alert("load")
mst.hide()
}
},
callback:function(r,options,success)
{
alert('2')
if(success)
{
alert("1")
var recordds=new Array();
for(var i=0;i<r.length;i++)
{
alert(r[i].data.caPk);
};
}
}
}
);
var grid=new Ext.grid.GridPanel
(
{
height : 300,
cm:cum,
layout : 'form',
region:'center',
id:'grid',
store:busnieStore,
renderTo:'cbt',
viewConfig:
{
forceFit:true
}
}
);
busnieStore.load();
}
)
---------后台
<%
System.out.println("kaishi.....");
try
{
String JSONStr="{totalProperty:1,root:[{ACTORG:'15601',LAYERTYPE:'0余额',AVILBL:'0',LAYERNO:'0',CUSTOMERNO:'9394',SUMBAL:'0'}]}";
response.getWriter().write(JSONStr);
}
catch(Exception e)
{
}
%>
谁能帮我看一下,前台读取后台数据,为什么显示不出来,跪求,看了一天了 展开
2个回答
展开全部
{name:'LAYERNO'},
{name:'LAYERTYPE'},
{name:'ACTORG'},
{name:'CUSTOMERNO'},
{name:'AVILBL'},
{name:'SUMBAL'}
拜托,这里面的值全部用小写啊,大写不行的,如name:'layerno‘这样才行,而且需要把后台的对应字段也改为小写哈
{name:'LAYERTYPE'},
{name:'ACTORG'},
{name:'CUSTOMERNO'},
{name:'AVILBL'},
{name:'SUMBAL'}
拜托,这里面的值全部用小写啊,大写不行的,如name:'layerno‘这样才行,而且需要把后台的对应字段也改为小写哈
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-07-30
展开全部
1、这里的定义能否访问到服务端页面?url:"shit.jsp"
2、
var myReader = new Ext.data.JsonReader({
// metadata configuration options:
idProperty: 'id'
root: 'rows',
totalProperty: 'results',
// the fields config option will internally create an Ext.data.Record
// constructor that provides mapping for reading the record data objects
fields: [
// map Record's 'firstname' field to data object's key of same name
{name: 'name', mapping: 'firstname'},
// map Record's 'job' field to data object's 'occupation' key
{name: 'job', mapping: 'occupation'}
]
});
2、
var myReader = new Ext.data.JsonReader({
// metadata configuration options:
idProperty: 'id'
root: 'rows',
totalProperty: 'results',
// the fields config option will internally create an Ext.data.Record
// constructor that provides mapping for reading the record data objects
fields: [
// map Record's 'firstname' field to data object's key of same name
{name: 'name', mapping: 'firstname'},
// map Record's 'job' field to data object's 'occupation' key
{name: 'job', mapping: 'occupation'}
]
});
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询