Fixes broken selection of number of records

Fixes #5400
This commit is contained in:
Simone Mainardi 2021-05-24 17:14:17 +02:00
parent eacea50c97
commit 7ee96ee1c6
3 changed files with 54 additions and 50 deletions

View file

@ -927,56 +927,60 @@
}
function _initPerPage() {
var o = this.options,
$e = this.$element,
that = this;
var o = this.options,
$e = this.$element,
that = this;
// per page options and current filter/sorting
var $perpage_select = $("<a></a>")
.addClass("btn dropdown-toggle")
.data("content", i18n.change_number_of_rows + ".")
.attr("data-toggle", "dropdown")
.html(o.perPage + "&nbsp;")
.css({ fontWeight: "normal" })
.append($("<span></span>").addClass("caret"))
this.buttons.push($perpage_select);
// per page options and current filter/sorting
var $perpage_select = $("<div></div>")
.addClass("btn-group")
.append($("<button></button>")
.addClass("btn btn-link dropdown-toggle")
.data("content", i18n.change_number_of_rows + ".")
.attr("data-bs-toggle", "dropdown")
.html(o.perPage + "&nbsp;")
.append($("<span></span>")
.addClass("caret")));
var $perpage_values = $("<ul></ul>")
.addClass("dropdown-menu")
.css({ fontSize: "initial", fontWeight: "normal" })
.append(
$(
'<li data-value="10"><a class="dropdown-item" href="#">10</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="20"><a class="dropdown-item" href="#">20</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="50"><a class="dropdown-item" href="#">50</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="100"><a class="dropdown-item" href="#">100</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="200"><a class="dropdown-item" href="#">200</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
})
);
this.buttons.push($perpage_values);
var $perpage_values = $("<ul></ul>")
.addClass("dropdown-menu scrollable-dropdown")
.attr("role", "menu")
.append(
$(
'<li data-value="10"><a class="dropdown-item" href="#">10</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="20"><a class="dropdown-item" href="#">20</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="50"><a class="dropdown-item" href="#">50</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="100"><a class="dropdown-item" href="#">100</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
}),
$(
'<li data-value="200"><a class="dropdown-item" href="#">200</a></li>'
).click(function() {
_updatePerPage.call(this, that);
return false;
})
);
$perpage_select.append($perpage_values);
this.buttons.push($perpage_select);
}
function _initTableInfo() {