4 Answers, 1 is accepted
You could change the grid pager dropDownList width using the following CSS rule:
.k-pager-wrap .k-dropdown{ width: 280px; /* specify the width */}Iliana Nikolova
Telerik
Thanks Iliana. This doesn't solve the problem I'm having. I don't see how to control where these elements get their width setting.
Here is a js.bin to demonstrate the issue:
http://jsbin.com/eqocIYIf/1/edit
(apologies for the messy CSS - I had to hack it out of some large files)
In case you would like to change the pager DropDownList list width you could use the following code snippet:
var ddl = $('[data-role="dropdownlist"]').data("kendoDropDownList");ddl.list.width(100);Regards,
Iliana Nikolova
Telerik
If you want to force the DropDownList element to auto resize it's width and force the DropDownList and Items List to have the same width, you can use the following JS code. I include it in the following grid DataBound event handling function that also updates the grid PageSize to show all items in the grid DataSource.
var onDataBound = function() {
try {
if (dataIsBound === false) {//this is a global JS variable that is initialized as false when the page loads
dataIsBound = true;
var grid = $("#yourGridName").data("kendoGrid");
if (grid != null) {
if (grid.dataSource != null) {
if (grid.dataSource.data() != null) {
dataItems = grid.dataSource.data();
if (dataItems != null) {
// ensure all data source items are displayed
grid.dataSource.pageSize(dataItems.length);
grid.refresh();
// force dropdownlist and items list to have same width:
var ddl = $('[data-role="dropdownlist"]').data("kendoDropDownList");
if (ddl != null && ddl.list != null) {
var ele = $('[role="listbox"]');
if (ele != null) {
ele.width("auto");
ddl.list.width(ele.width());
console.log("---- updated ele.width(auto) = " + ele.width());
console.log("---- updated ddl.list.width = " + ddl.list.width());
}
}
}
}
}
}
}
} catch (ex) {
console.log("error: " + ex.message);
}
};