Javascript Extjs:在网格上显示数据
虽然我在响应中得到了输出 回应Javascript Extjs:在网格上显示数据,javascript,extjs,extjs4,extjs4.1,extjs4.2,Javascript,Extjs,Extjs4,Extjs4.1,Extjs4.2,虽然我在响应中得到了输出 回应 这是我的商店和网格 但它在网格上不可见 请帮助您需要定义一个读取器: reader: { type: 'json', rootProperty: 'result', totalProperty: 'totalcount' } 您的工作示例: var store = Ext.create('Ext.data.Store', { autoLoad: true, fields: [{ name: 'd
这是我的
商店
和网格
但它在
网格上不可见
请帮助您需要定义一个读取器
:
reader: {
type: 'json',
rootProperty: 'result',
totalProperty: 'totalcount'
}
您的工作示例:
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
fields: [{
name: 'date',
type: 'string'
}, {
name: 'emailID',
type: 'string'
}, {
name: 'name',
type: 'string'
}],
pageSize: 10, // items per page
id: 'date',
proxy: {
method: 'GET',
url: 'rest/helloworld/submit',
noCache: false,
type: 'ajax',
root: 'result',
totalProperty: 'totalcount'
}
});
// specify segment of data you want to load using params
store.load({
params: {
start: 0,
limit: 10
}
});
var grid = Ext.create('Ext.grid.Panel', {
title: 'Result',
store: store,
columns: [{
header: 'Name',
dataIndex: 'name'
}, {
header: 'Email',
dataIndex: 'emailID',
flex: 1
}, {
header: 'Date',
dataIndex: 'date'
}],
width: 400,
dockedItems: [{
xtype: 'pagingtoolbar',
store: store,
dock: 'bottom',
displayInfo: true
}],
renderTo: Ext.getBody()
});
reader: {
type: 'json',
rootProperty: 'result',
totalProperty: 'totalcount'
}