如何在 Kendo UI 网格中加宽弹出窗口 window?
How can I widen the popup window in Kendo UI grid?
我想在 Kendo UI 网格中加宽弹出窗口 window。这样其中的元素也填充了 window.
在答案 中只有 window 变宽了,但其中包含的元素没有变宽。
在kendoGrid 的区域中,将以下代码添加到事件编辑中:
jQuery("#grid").kendoGrid({
...
edit: function(e){
kendoUi_popUpEditWindow_setWidth('950px');
},
...
})
以及对应的函数:
function kendoUi_popUpEditWindow_setWidth(width){
if(typeof(width) != "string" || (width + '').indexOf("px") == -1 ){
width = "800px";
}
left = (jQuery( window ).width() - parseInt(width)) / 2;
left = left + "px";
jQuery(".k-widget.k-window").css('left', left);
jQuery(".k-edit-form-container").attr('style', 'width:' + width);
jQuery(".k-edit-form-container .k-edit-field").children().attr('style', 'width:100%');
}
简单地在您的网格定义中提供宽度:https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/editable.window or see 作为实际示例。
我想在 Kendo UI 网格中加宽弹出窗口 window。这样其中的元素也填充了 window.
在答案
在kendoGrid 的区域中,将以下代码添加到事件编辑中:
jQuery("#grid").kendoGrid({
...
edit: function(e){
kendoUi_popUpEditWindow_setWidth('950px');
},
...
})
以及对应的函数:
function kendoUi_popUpEditWindow_setWidth(width){
if(typeof(width) != "string" || (width + '').indexOf("px") == -1 ){
width = "800px";
}
left = (jQuery( window ).width() - parseInt(width)) / 2;
left = left + "px";
jQuery(".k-widget.k-window").css('left', left);
jQuery(".k-edit-form-container").attr('style', 'width:' + width);
jQuery(".k-edit-form-container .k-edit-field").children().attr('style', 'width:100%');
}
简单地在您的网格定义中提供宽度:https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/editable.window or see