缓存的商店网格在滚动后不记得选择

时间:2017-03-02 06:07:08

标签: grid store extjs4.1 buffered

我在extjs 4.1中使用缓冲存储网格后检查标题复选框所有记录都在视图中检查,如果我滚动到最后一个并返回到第一个记录我的标题复选框和一些行取消选中。我在选择模型上使用了prunRemoved false。请提供解决方法。感谢

我的网格和网格商店:

var bufferedStore = Ext.create('Ext.data.Store', {
        fields: ['key', 'fullName', 'text'],
        buffered: true,
        purgePageCount: null,
        pageSize: 50,
        leadingBufferZone: 200,
        trailingBufferZone: 200,
        proxy: {
            type: 'direct',
            directFn: diFn,
            reader: {
                type: 'json',
                root: 'data',
                totalProperty: 'total'
            }
        },
        remoteFilter : true
    });


 var tabGridPanel = Ext.create('Ext.grid.Panel', {
        itemId : _gridPanelId,
        maxWidth: 478,
        minWidth: 328,
        width: 328,
        maxHeigth : 150,
        minHeight : 40,
        rowLines: false,
        store : _store,
        id : panelId,
        searchAllowed : _showSearch,
        persistedSelections : {},
        selModel: new Ext.selection.CheckboxModel({
            allSelected : false,
            allDeSelected : false,
            mode : 'SIMPLE',
            includeFuture : false,
            pruneRemoved: false
        }),
        viewConfig: {
            stripeRows: true,
            deferEmptyText: false,
            emptyText: ' No instance available',
            listeners: {
                    'refresh': function(view, opt) {
                    var grid = mainPanel.queryById(_gridPanelId);
                    var store = view.getStore();
                    var selModel = grid.getSelectionModel();

                    var record = view.getStore().findRecord("text", "all",0, false, true, true);
                    if (!selModel.allSelected && selModel.isSelected(record))
                        selModel.deselect(record,true);

                    if (selModel.allSelected)
                        selModel.selectAll(true);
                    else if (selModel.allDeSelected) 
                        selModel.deselectAll(true);
                    else{
                        for (var i in grid.persistedSelections) {
                            var index = store.findExact('fullName',i);
                            if (index != -1) {
                                grid.getSelectionModel().select(index,true,true);
                            }
                        }
                    }
                },
                'afterrender' : function() {
                    this.el.dom.style['overflow-x'] = 'hidden';
                    this.el.dom.style['overflow-y'] = 'auto';
                }
            }
        },
        columns: [{ 
            dataIndex: 'fullName',   
            width : "92%",
            menuDisabled: true,
            sortable:false
        }]
    });

当我正常滚动时,选择仍然存在,但如果我直接进入结尾,某些行也会被取消选中,也会使用标题复选框。

0 个答案:

没有答案