0

检查标题复选框后,我在 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
        }]
    });

当我正常滚动时,选择仍然存在,但如果我直接走到最后,一些行也会被标题复选框取消选中。

4

0 回答 0