Skip to content

Commit b886aa1

Browse files
committed
- Fix pageNumber bug causing index of -1 when pageCount == 0.
- Fix bug causing double refresh when setting but not changing pageNumber inside refresh()
1 parent b1f6524 commit b886aa1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Griddly.NetCore/wwwroot/js/griddly.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,18 +769,18 @@
769769
event.preventDefault();
770770
}, this));
771771

772-
$("input.pageNumber", this.$element).on("change", $.proxy(function (event)
773-
{
772+
$("input.pageNumber", this.$element).on("change", $.proxy(function (event) {
774773
var value = parseInt($(event.target).val());
775774

776-
if (value < 1)
775+
if (value < 1 || this.options.pageCount == 0)
777776
value = 1;
778777
else if (value > this.options.pageCount)
779778
value = this.options.pageCount;
780779

781-
this.options.pageNumber = value - 1;
782-
783-
this.refresh();
780+
if (this.options.pageNumber != value - 1) {
781+
this.options.pageNumber = value - 1;
782+
this.refresh();
783+
}
784784
}, this));
785785

786786
$("select.pageSize", this.$element).on("change", $.proxy(function (event)

Griddly/Scripts/griddly.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,15 @@
773773
{
774774
var value = parseInt($(event.target).val());
775775

776-
if (value < 1)
776+
if (value < 1 || this.options.pageCount == 0)
777777
value = 1;
778778
else if (value > this.options.pageCount)
779779
value = this.options.pageCount;
780780

781-
this.options.pageNumber = value - 1;
782-
783-
this.refresh();
781+
if (this.options.pageNumber != value - 1) {
782+
this.options.pageNumber = value - 1;
783+
this.refresh();
784+
}
784785
}, this));
785786

786787
$("select.pageSize", this.$element).on("change", $.proxy(function (event)

0 commit comments

Comments
 (0)