Simply toggling the visibility of columns.
After some debugging today, what I'm finding is that calling setVisible eventually calls Ext.view.AbstractView.refresh(), and in there, even if 'preserveScrollOnRefresh' is set to true, it clears out and seems to reload my grid. But, I'm not sure if the problem is there, or if it's in 'refreshSelection()', which gets called at the end of the Ext.view.Table.refresh() method.
Below is the Ext.view.Table.refresh method and refreshSelection. The me.callParent(arguments) calls the Ext.view.AbstractView.refresh method.
Code:
refresh:function(){ var me = this;
me.callParent(arguments);
me.headerCt.setSortState();
// Create horizontal stretcher element if no records in view and there is overflow of the header container.
// Element will be transient and destroyed by the next refresh.
if (me.el && me.headerCt && !me.ownerCt.hideHeaders && me.headerCt.tooNarrow && !me.all.getCount()) {
me.el.createChild({
role: 'presentation',
style:'position:absolute;height:1px;width:1px;left:' + (me.headerCt.getTableWidth() - 1) + 'px'
});
}
me.refreshSelection();
},
refreshSelection: function() {
var me = this,
selModel = me.selModel,
selected, len, i;
if (selModel.isRowModel) {
selected = selModel.selected.items;
len = selected.length;
for (i = 0; i < len; i++) {
me.onRowSelect(me.indexOf(me.getNode(selected[i])));
}
}
me.selModel.onLastFocusChanged(null, me.selModel.lastFocused, true); },