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) {
33
33
*/
34
34
this . pagination = null ;
35
35
36
+ /**
37
+ * Saved scroll positions.
38
+ * @type {{x: number, y: number} }
39
+ */
40
+ this . savedScroll = {
41
+ x : 0 ,
42
+ y : 0
43
+ } ;
44
+
36
45
this . PAGINATION_BLOCK_HEIGHT = 20 ;
37
46
this . ANIMATION_TIMEOUT = 500 ;
38
47
@@ -168,6 +177,34 @@ PivotView.prototype.popTable = function () {
168
177
169
178
} ;
170
179
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
+
171
208
/**
172
209
* Data change handler.
173
210
*
@@ -193,7 +230,9 @@ PivotView.prototype.dataChanged = function (data) {
193
230
194
231
PivotView . prototype . _columnClickHandler = function ( columnIndex ) {
195
232
233
+ this . saveScrollPosition ( ) ;
196
234
this . controller . dataController . sortByColumn ( columnIndex ) ;
235
+ this . restoreScrollPosition ( ) ;
197
236
198
237
} ;
199
238
You can’t perform that action at this time.
0 commit comments