File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ var PivotView = function (controller, container) {
3333 */
3434 this . pagination = null ;
3535
36+ /**
37+ * Saved scroll positions.
38+ * @type {{x: number, y: number} }
39+ */
40+ this . savedScroll = {
41+ x : 0 ,
42+ y : 0
43+ } ;
44+
3645 this . PAGINATION_BLOCK_HEIGHT = 20 ;
3746 this . ANIMATION_TIMEOUT = 500 ;
3847
@@ -168,6 +177,34 @@ PivotView.prototype.popTable = function () {
168177
169178} ;
170179
180+ PivotView . prototype . saveScrollPosition = function ( ) {
181+
182+ var els ;
183+
184+ if (
185+ this . elements . tableContainer
186+ && ( els = this . elements . tableContainer . getElementsByClassName ( "lpt-tableBlock" ) )
187+ ) {
188+ this . savedScroll . x = els [ 0 ] . scrollLeft ;
189+ this . savedScroll . y = els [ 0 ] . scrollTop ;
190+ }
191+
192+ } ;
193+
194+ PivotView . prototype . restoreScrollPosition = function ( ) {
195+
196+ var els ;
197+
198+ if (
199+ this . elements . tableContainer
200+ && ( els = this . elements . tableContainer . getElementsByClassName ( "lpt-tableBlock" ) )
201+ ) {
202+ els [ 0 ] . scrollLeft = this . savedScroll . x ;
203+ els [ 0 ] . scrollTop = this . savedScroll . y ;
204+ }
205+
206+ } ;
207+
171208/**
172209 * Data change handler.
173210 *
@@ -193,7 +230,9 @@ PivotView.prototype.dataChanged = function (data) {
193230
194231PivotView . prototype . _columnClickHandler = function ( columnIndex ) {
195232
233+ this . saveScrollPosition ( ) ;
196234 this . controller . dataController . sortByColumn ( columnIndex ) ;
235+ this . restoreScrollPosition ( ) ;
197236
198237} ;
199238
You can’t perform that action at this time.
0 commit comments