After ext4.2 Grid refresh the scroll bar position remains unchanged

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/lihua5419/article/details/89877144

Note: EXT4.2 version

The method is to record the position of the scroll bar. So to add the following property parameters grid inside the viewConfig

viewConfig:{onLoad : Ext.emptyFn,  
			listeners : {  
						beforerefresh : function(v) {  
						v.scrollTop = v.el.dom.scrollTop;  
						v.scrollHeight = v.el.dom.scrollHeight;  
						},  
			refresh : function(v) {  
					v.el.dom.scrollTop = v.scrollTop  
					+ (v.scrollTop == 0  
					? 0  
					: v.el.dom.scrollHeight  
					- v.scrollHeight);  
					}  
}

First, configure the code above property is absolutely no problem, if the above parameters are still rolling over the property plus, Refresh Grid bar to scroll to the top of the code when the Grid data loading and then check the next, do not removeAl data loading data. . . .

If you want all the grid so you can achieve this function, the following code (yet to achieve: I do not know where to put, tried to place within some of the js file, not its function)

Ext.override(Ext.grid.GridView, {  
    scrollTop : function() {  
        this.el.dom.scrollTop = 0;  
        this.el.dom.scrollLeft = 0;  
    },  
    scrollToTop : Ext.emptyFn  
}); 

 

Guess you like

Origin blog.csdn.net/lihua5419/article/details/89877144