@@ -71,6 +71,19 @@ export default class BodyController {
7171 }
7272 }
7373
74+ /**
75+ * @description Constructs the rows for the page, assuming we're using internal paging.
76+ */
77+ buildInternalPage ( ) {
78+ let i ;
79+
80+ this . tempRows . splice ( 0 , this . tempRows . length ) ;
81+
82+ for ( i = 0 ; i < this . options . paging . size ; i += 1 ) {
83+ this . tempRows [ i ] = this . rows [ ( this . options . paging . offset * this . options . paging . size ) + i ] ;
84+ }
85+ }
86+
7487 setConditionalWatches ( ) {
7588 for ( let i = this . watchListeners . length - 1 ; i >= 0 ; i -= 1 ) {
7689 this . watchListeners [ i ] ( ) ;
@@ -82,7 +95,7 @@ export default class BodyController {
8295 ( this . options . scrollbarV ||
8396 ( ! this . options . scrollbarV &&
8497 this . options . paging &&
85- this . options . paging . externalPaging ) ) ) {
98+ this . options . paging . size ) ) ) {
8699 let sized = false ;
87100
88101 this . watchListeners . push ( this . $scope . $watch ( 'body.options.paging.size' , ( newVal , oldVal ) => {
@@ -99,10 +112,16 @@ export default class BodyController {
99112
100113 this . watchListeners . push ( this . $scope . $watch ( 'body.options.paging.offset' , ( newVal ) => {
101114 if ( this . options . paging . size ) {
102- this . onPage ( {
103- offset : newVal ,
104- size : this . options . paging . size ,
105- } ) ;
115+ if ( ! this . options . paging . externalPaging ) {
116+ this . buildInternalPage ( ) ;
117+ }
118+
119+ if ( this . onPage ) {
120+ this . onPage ( {
121+ offset : newVal ,
122+ size : this . options . paging . size ,
123+ } ) ;
124+ }
106125 }
107126 } ) ) ;
108127 }
@@ -137,14 +156,19 @@ export default class BodyController {
137156 }
138157
139158 if ( this . options . paging . externalPaging ) {
159+ // We're using external paging
140160 const idxs = this . getFirstLastIndexes ( ) ;
141161 let idx = idxs . first ;
142162
143163 this . tempRows . splice ( 0 , this . tempRows . length ) ;
144164 while ( idx < idxs . last ) {
145165 this . tempRows . push ( rows [ idx += 1 ] ) ;
146166 }
167+ } else if ( this . options . paging . size ) {
168+ // We're using internal paging
169+ this . buildInternalPage ( ) ;
147170 } else {
171+ // No paging
148172 this . tempRows . splice ( 0 , this . tempRows . length ) ;
149173 this . tempRows . push ( ...rows ) ;
150174 }
@@ -439,7 +463,9 @@ export default class BodyController {
439463 rowIndex += 1 ;
440464 }
441465
442- this . options . internal . styleTranslator . update ( this . tempRows ) ;
466+ if ( this . options . internal && this . options . internal . styleTranslator ) {
467+ this . options . internal . styleTranslator . update ( this . tempRows ) ;
468+ }
443469
444470 return this . tempRows ;
445471 }
0 commit comments