首页 新闻 赞助 找找看

Ext4.2MVC Grid显示不了数据

0
悬赏园豆:50 [已关闭问题] 关闭于 2013-12-31 16:29

controller

Ext.define('vts.controller.HomeController', {
extend: 'Ext.app.Controller',
views: ['Viewport', 'Main_Center', 'Main_Left'],
stores: ['Main_Left_GongGaoStore'],
model: ['Main_Left_GongGaoModel']
});

 

Main_Left视图

Ext.define('vts.view.Main_Left', {
extend: 'Ext.panel.Panel',
border: false,
alias: 'widget.Main_Left',
items: [{
region: 'south',
xtype: 'tabpanel',
height: 300,
activeTab: 0,
items: [{
title: '登陆信息',
html: ''
}, {
title: '系统信息',
html: ''
}]
}, {
title: '公告',
region: 'center',
layout: 'fit',
xtype: 'gridpanel',
store:'Main_Left_GongGaoStore',
columns: [
{ text: 'title', dataIndex: 'title' },
{ text: 'remark', dataIndex: 'remark'}
]
}]
});

 

MODEl

Ext.define('vts.model.Main_Left_GongGaoModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'title', type: 'varchar' },
{ name: 'remark', type: 'varchar' }
]
});

store

Ext.define("vts.store.Main_Left_GongGaoStore", {extend: 'Ext.data.Store',

requires: 'vts.model.Main_Left_GongGaoModel',
model: 'vts.model.Main_Left_GongGaoModel',
proxy: {
type: 'ajax',
url: '/VTS/Scripts/Json/Main_Left_GongGaoJson.json',
reader: 'json',
autoLoad: true
}
});

 

JSON文件

[{"title":"123","remark":"123"}]

 

页面显示正常,没有任何报错,但是表格控件就是没有数据显示,我用chrome浏览器监视到JSOn文件没有加载,但是我直接/VTS/Scripts/Json/Main_Left_GongGaoJson.json输入这个网址能正常显示JSON文件,求牛人解决下,本人是刚刚新学EXTJS的

asdfas234的主页 asdfas234 | 初学一级 | 园豆:22
提问于:2013-12-31 15:16
< >
分享
所有回答(2)
0

store

Ext.define("vts.store.Main_Left_GongGaoStore", {extend: 'Ext.data.Store',

requires: 'vts.model.Main_Left_GongGaoModel',
model: 'vts.model.Main_Left_GongGaoModel',
proxy: {
type: 'ajax',
url: '/VTS/Scripts/Json/Main_Left_GongGaoJson.json',
reader: 'json'
},

autoLoad: true
});

 

autoLoad: true这个属性放错地方了

asdfas234 | 园豆:22 (初学一级) | 2013-12-31 16:33
0

1.没有json文件,应该是请求的路径有些问题(调试或者看看network,如果路径问题,会发现请求文件404)

2.如果能进到后台,就调试后台的代码,这个不在你本次问题(因为你是直接请求的json文件)

总而言之,善用调试,尤其是写js的时候,一定要认真,js智能提示不给力

秋壶冰月 | 园豆:5903 (大侠五级) | 2013-12-31 16:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册