extjs从后台读取数据

xiaoziwawawa 2015-06-26 02:35:21
新手,刚开始用extjs技术,从action中已经可以拿到数据,alert显示出来了,就是不能在页面中显示,求赐教!
Ext.define('MyDesktop.WeiboCrawl', {
extend: 'Ext.ux.desktop.Module',
requires: [
'Ext.data.ArrayStore',
'Ext.util.Format',
'Ext.grid.Panel',
'Ext.grid.RowNumberer'
],
id: 'weiboCrwal',
//初始化
init: function() {
this.launcher = {
text: 'WeiboCrawl',
iconCls: 'icon-grid'
};
},
createWindow: function() {
var desktop = this.app.getDesktop();
var win = desktop.getWindow('weiboCrwal');
if (!win) {
win = desktop.createWindow({
id: 'weiboCrwal',
title: 'WeiboCrawl',
width: 740,
height: 480,
iconCls: 'icon-grid',
animCollapse: false,
constrainHeader: true,
layout: 'fit',
items: [
{
border: false,
xtype: 'grid',
store: new Ext.data.ArrayStore({
fields: [
{name: 'c_name', type: 'String'},
{name: 'c_where', type: 'String'},
{name: 'c_id', type: 'String'}
],
//从数据库中获取数据=================================
data: MyDesktop.WeiboCrawl.getDummyData()
}),
columns: [
new Ext.grid.RowNumberer(), //自动生成数字,为每行提供编号的列
{
text: "c_name", //表头的显示内容
flex: 1, //占用剩余宽度
sortable: true, //若需禁止该列排序,则设置为False
dataIndex: 'c_name'//某个field来作为该列的value值
},
{
text: "c_where",
width: 70,
sortable: true,
dataIndex: 'c_where'
},
{
text: "c_id",
width: 70,
sortable: true,
dataIndex: 'c_id'
}
]
}
],
tbar: [{
text: 'Add Something',
tooltip: 'Add a new row', //工具提示框
iconCls: 'add'
}, '-', {
text: 'Options',
tooltip: 'Modify options',
iconCls: 'option'
}, '-', {
text: 'Remove Something',
tooltip: 'Remove the selected item',
iconCls: 'remove'
}]
});
}
return win;
},
statics: {
getDummyData: function() {
var value = '';
Ext.Ajax.request({
url: 'queryData.htm',
params: {
id: 1
},
method: 'post',
success: function(response) {
value = response.responseText;//拿到Action返回的数据
alert(value);
}
});
return value;
}
}
});




...全文
96 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoziwawawa 2015-06-26
  • 打赏
  • 举报
回复
怎么没人啊

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧