Is there a way to specify an "All" option in the "Items Per Page" drop down feature? Simply setting the last option to a number above the total record set is not what the client wants. They would like to see an "All" option.
Thanks..
1 Answer, 1 is accepted
0
Dimiter Madjarov
Telerik team
answered on 17 May 2013, 02:44 PM
Hi Christian,
Yes it is possible to achieve this. You should get the data for the page sizes DropDownList and add the new item to it's dataSource. Since the DropDownList displays the value of the selected item, you should also bind to it's change event and replace the text of the selected item to "All". I am attaching a sample code below.
E.g.
$(document).ready(function () {
var grid = $("#Grid").data("kendoGrid");
var dropdown = grid.pager.element
.find(".k-pager-sizes [data-role=dropdownlist]")
.data("kendoDropDownList");
var item = {};
item[dropdown.options.dataTextField] = "All";
item[dropdown.options.dataValueField] = 1000000;
dropdown.dataSource.add(item);
dropdown.bind("change", function (e) {
if (this.text() == "All") {
grid.one("dataBound", function () {
setTimeout(function () {
dropdown.span.text("All");
});
});
}
});
});
Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!