ExtJS存储显示网格问题

时间:2015-04-21 19:19:30

标签: extjs gridview paging

我有一个问题,我试图在一个页面上的可滚动网格中显示商店的全部内容,但不管我做什么,当我将它加载到商店时,我只返回商店中的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。

1 个答案:

答案 0 :(得分:0)

哈!当然,我只是想出来了:http://www.sencha.com/forum/showthread.php?121356-limit-in-Store-requests-always-25

    storeId: 'Results',
    autoLoad: true,
    pageSize: undefined,

做到了。