ExtJS 商店显示网格问题
ExtJS store display issue with grid
我遇到了一个问题,我试图在单个页面上的可滚动网格中显示商店的全部内容,但无论我做什么,我在加载它时只返回商店中的 25 条记录到网格。
这是我的商店:
Ext.define('cardioCatalogQT.store.Results', {
extend: 'Ext.data.Store',
alias: 'store.Results',
config:{
idProperty: 'id',
fields: [
{name: 'attribue', type: 'string'},
{name: 'sid', type: 'string'},
{name: 'value', type: 'string'},
{name: 'n', type: 'string'}
],
storeId: 'Results',
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'results'
}
}
});
这是我的带有网格组件的容器:
Ext.define('cardioCatalogQT.view.grid.Results', {
extend: 'Ext.container.Container',
alias: 'widget.resultsGrid',
itemId: 'test',
title: 'Test',
requires: [
'cardioCatalogQT.view.main.MainController',
'Ext.ux.exporter.Exporter'
],
items: [{
xtype: 'exporterbutton',
component: '#gridTest',
region: 'north'
},{
xtype: 'tbspacer',
height: 10
}, {
xtype: 'gridpanel',
store: 'Results',
itemId:'gridTest',
autoScroll:true,
autoHeight: true,
maxHeight: 250,
columns: [{
text: 'sid',
dataIndex: 'sid'
}]
}]
});
我使用以下命令从服务器获得成功的 Ajax 响应后,将存储中的数据加载到网格面板中:
button.up().up().up().down('#gridTest').getStore().load();
这会刷新存储并将数据加载到网格中,但它只会从存储中获取前 25 条记录,正如此命令的输出所示:
[Log] Object (MainController.js, line 124)
autoFilter: true
autoLoad: true
autoSort: true
blockLoadCounter: 0
byInternalId: Object
complete: true
config: Object
data: Object[25]
_extraKeys: Object
_filters: Object[0]
_rootProperty: "data"
_sortFn: null
_sorters: Object[0]
byInternalId: Object
config: Object
events: Object
generation: 5
hasListeners: Object
indexRebuilds: 1
indices: Object
initConfig: function () {}
initialConfig: Object
items: Array[25]
0: Object
1: Object
2: Object
3: Object
4: Object
5: Object
6: Object
7: Object
8: Object
9: Object
10: Object
11: Object
12: Object
13: Object
14: Object
15: Object
16: Object
17: Object
18: Object
19: Object
20: Object
21: Object
22: Object
23: Object
24: Object
length: 25
__proto__: Array[0]
length: 25
managedListeners: Array[2]
map: Object
observerMap: Object
observers: Array[2]
updating: 0
__proto__: Object
events: Object
filters: Object[0]
getId: function () {
getUniqueId: function () {
hasListeners: Object
id: "cardiocatalogqt-store-results-1"
ignoreCollectionAdd: false
ignoreCollectionRemove: false
implicitModel: true
initConfig: function () {}
initialConfig: Object
isFirstInstance: true
isInitializing: false
lastOptions: Object
loadCount: 3
loadTask: null
loading: false
loadsWhileBlocked: 0
managedListeners: Array[4]
model: function constructor() {
proxy: Object
remoteFilter: false
remoteSort: false
removed: Array[0]
sorters: Object[0]
totalCount: 25
trackRemoved: true
trackStateChanges: true
updating: 0
__proto__: Object
但是,如果我打印出商店本身的内容,则有 72 条记录。
我认为这是某种寻呼问题,但我发现的所有内容都与 ajax/rest 代理的使用有关。我尝试添加
pageParam: undefined
给商店的代理,但这没有任何帮助。注意:我不想使用分页工具栏,我只想在单个可滚动页面上打印整个记录集,以便我可以将其导出为 CSV。
哈!当然,我只是想通了:http://www.sencha.com/forum/showthread.php?121356-limit-in-Store-requests-always-25.
storeId: 'Results',
autoLoad: true,
pageSize: undefined,
做到了。
我遇到了一个问题,我试图在单个页面上的可滚动网格中显示商店的全部内容,但无论我做什么,我在加载它时只返回商店中的 25 条记录到网格。
这是我的商店:
Ext.define('cardioCatalogQT.store.Results', {
extend: 'Ext.data.Store',
alias: 'store.Results',
config:{
idProperty: 'id',
fields: [
{name: 'attribue', type: 'string'},
{name: 'sid', type: 'string'},
{name: 'value', type: 'string'},
{name: 'n', type: 'string'}
],
storeId: 'Results',
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'results'
}
}
});
这是我的带有网格组件的容器:
Ext.define('cardioCatalogQT.view.grid.Results', {
extend: 'Ext.container.Container',
alias: 'widget.resultsGrid',
itemId: 'test',
title: 'Test',
requires: [
'cardioCatalogQT.view.main.MainController',
'Ext.ux.exporter.Exporter'
],
items: [{
xtype: 'exporterbutton',
component: '#gridTest',
region: 'north'
},{
xtype: 'tbspacer',
height: 10
}, {
xtype: 'gridpanel',
store: 'Results',
itemId:'gridTest',
autoScroll:true,
autoHeight: true,
maxHeight: 250,
columns: [{
text: 'sid',
dataIndex: 'sid'
}]
}]
});
我使用以下命令从服务器获得成功的 Ajax 响应后,将存储中的数据加载到网格面板中:
button.up().up().up().down('#gridTest').getStore().load();
这会刷新存储并将数据加载到网格中,但它只会从存储中获取前 25 条记录,正如此命令的输出所示:
[Log] Object (MainController.js, line 124)
autoFilter: true
autoLoad: true
autoSort: true
blockLoadCounter: 0
byInternalId: Object
complete: true
config: Object
data: Object[25]
_extraKeys: Object
_filters: Object[0]
_rootProperty: "data"
_sortFn: null
_sorters: Object[0]
byInternalId: Object
config: Object
events: Object
generation: 5
hasListeners: Object
indexRebuilds: 1
indices: Object
initConfig: function () {}
initialConfig: Object
items: Array[25]
0: Object
1: Object
2: Object
3: Object
4: Object
5: Object
6: Object
7: Object
8: Object
9: Object
10: Object
11: Object
12: Object
13: Object
14: Object
15: Object
16: Object
17: Object
18: Object
19: Object
20: Object
21: Object
22: Object
23: Object
24: Object
length: 25
__proto__: Array[0]
length: 25
managedListeners: Array[2]
map: Object
observerMap: Object
observers: Array[2]
updating: 0
__proto__: Object
events: Object
filters: Object[0]
getId: function () {
getUniqueId: function () {
hasListeners: Object
id: "cardiocatalogqt-store-results-1"
ignoreCollectionAdd: false
ignoreCollectionRemove: false
implicitModel: true
initConfig: function () {}
initialConfig: Object
isFirstInstance: true
isInitializing: false
lastOptions: Object
loadCount: 3
loadTask: null
loading: false
loadsWhileBlocked: 0
managedListeners: Array[4]
model: function constructor() {
proxy: Object
remoteFilter: false
remoteSort: false
removed: Array[0]
sorters: Object[0]
totalCount: 25
trackRemoved: true
trackStateChanges: true
updating: 0
__proto__: Object
但是,如果我打印出商店本身的内容,则有 72 条记录。
我认为这是某种寻呼问题,但我发现的所有内容都与 ajax/rest 代理的使用有关。我尝试添加
pageParam: undefined
给商店的代理,但这没有任何帮助。注意:我不想使用分页工具栏,我只想在单个可滚动页面上打印整个记录集,以便我可以将其导出为 CSV。
哈!当然,我只是想通了:http://www.sencha.com/forum/showthread.php?121356-limit-in-Store-requests-always-25.
storeId: 'Results',
autoLoad: true,
pageSize: undefined,
做到了。