EXTJS中grid不显示数据
Ext.require(['*']);Ext.define('roleModel',{extend:'Ext.data.Model',fields:[{name:'rol...
Ext.require(['*']);
Ext.define('roleModel', {
extend: 'Ext.data.Model',
fields: [{
name : 'roleCode',
mapping : 'roleCode'
}, {
name : 'roleName',
mapping : 'roleName'
}, {
name : 'memo',
mapping : 'memo'
} ]
});
Ext.onReady(function () {
var roleStore = Ext.create('Ext.data.Store', {
model: 'recordModel',
proxy: {
type: 'ajax',
method: 'POST',
url: 'getRole.do',
reader: {
type: 'json',
totalProperty: 'results',
root: 'rows'
}
},
autoLoad: true
});
var centerPanel = Ext.create('Ext.grid.Panel', {
region: 'center',
id: 'roleGridPanel',
store: roleStore,
title: '角色管理',
columns : [ {
header : '角色编码',
dataIndex : 'roleCode'
}, {
header : '角色编码',
dataIndex : 'roleName'
}, {
header : '备注',
dataIndex : 'memo'
} ]
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
renderTo: Ext.getBody(),
items: [centerPanel]
});
});
{"results":0,"rows":[{"roleCode":"role111","roleName":"roleName","memo":"memo"},{"roleCode":"rolecode","roleName":"roleName","memo":"memo"},{"roleCode":"ROOT","roleName":"管理员","memo":"1111"},{"roleCode":"STUDENT","roleName":"学生","memo":"1111"},{"roleCode":"TEACHER","roleName":"老师","memo":"11111"},{"roleCode":"工","roleName":"工","memo":"工"}]} 展开
Ext.define('roleModel', {
extend: 'Ext.data.Model',
fields: [{
name : 'roleCode',
mapping : 'roleCode'
}, {
name : 'roleName',
mapping : 'roleName'
}, {
name : 'memo',
mapping : 'memo'
} ]
});
Ext.onReady(function () {
var roleStore = Ext.create('Ext.data.Store', {
model: 'recordModel',
proxy: {
type: 'ajax',
method: 'POST',
url: 'getRole.do',
reader: {
type: 'json',
totalProperty: 'results',
root: 'rows'
}
},
autoLoad: true
});
var centerPanel = Ext.create('Ext.grid.Panel', {
region: 'center',
id: 'roleGridPanel',
store: roleStore,
title: '角色管理',
columns : [ {
header : '角色编码',
dataIndex : 'roleCode'
}, {
header : '角色编码',
dataIndex : 'roleName'
}, {
header : '备注',
dataIndex : 'memo'
} ]
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
renderTo: Ext.getBody(),
items: [centerPanel]
});
});
{"results":0,"rows":[{"roleCode":"role111","roleName":"roleName","memo":"memo"},{"roleCode":"rolecode","roleName":"roleName","memo":"memo"},{"roleCode":"ROOT","roleName":"管理员","memo":"1111"},{"roleCode":"STUDENT","roleName":"学生","memo":"1111"},{"roleCode":"TEACHER","roleName":"老师","memo":"11111"},{"roleCode":"工","roleName":"工","memo":"工"}]} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询