Skip to content

Commit 4c0c942

Browse files
committed
fix bug of not initialized lastItemIndex.
1 parent 3d273ef commit 4c0c942

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/aha-table.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
//pagesize: the number of items to show per page
380380
pagesize: 10,
381381
//currentpage: the current active page in view
382-
currentpage: 1,
382+
currentpage: 0,
383383
//pageCount: the number of paginated pages
384384
pageCount: 0,
385385
//itemCount: the number of visible items
@@ -414,6 +414,8 @@
414414
//Show element when it's ready.
415415
this.$.aha_table_main.setAttribute('resolved', '');
416416
this.$.aha_table_main.removeAttribute('unresolved');
417+
418+
this.currentpage = 1;
417419
},
418420

419421
//=============
@@ -439,7 +441,7 @@
439441
this.$.aha_table_main.setAttribute('resolved', '');
440442
this.$.aha_table_main.removeAttribute('unresolved');
441443
}
442-
this.refreshPagination();
444+
this.refreshPagination(true);
443445
},
444446
modifiedChanged: function() {},
445447
//translate value to labels for select
@@ -613,9 +615,11 @@
613615
this.viewingRows = filteredRows.slice(from, to);
614616
},
615617
// call this when total count is change.
616-
refreshPagination: function() {
617-
// Usually go to the first page is the best way to avoid chaos.
618-
this.currentpage = 1;
618+
refreshPagination: function(keepInTheCurentPage) {
619+
if (!keepInTheCurentPage) {
620+
// Usually go to the first page is the best way to avoid chaos.
621+
this.currentpage = 1;
622+
}
619623
// Cache the total page count and item count
620624
var count = 0;
621625
this.data.forEach(function(row) {

0 commit comments

Comments
 (0)