问题描述
我的Kendo网格的列过多.最初,我选择隐藏一些列,但是后来,我决定使用水平滚动条显示所有列.
I have a Kendo grid with too many columns. Initially I chose to hide some columns, but later I decided to display all the columns with a horizontal scrollbar.
我通过为每列分配一个宽度来做到这一点.当我这样做时,每列之间的行与标题行不同步.
I did this by assigning a width to each column. When I did so, the lines between each column are not in sync with the header lines.
我的意思是,网格数据部分中的行相对于标题行向左稍微移动.
I mean, the lines in the data part of the grid, are moved slightly to the left with respect to the header lines.
为澄清起见,当我以像素为单位给出每列的宽度时,上述问题仍然存在.但是,当我以%表示宽度时,不会显示滚动条.
To clarify, when I give the width for each column in pixels the above problem persists. But, when I give the width in %, the scrollbar is not displayed.
我想显示滚动条以显示所有列.
I want to display the scrollbar to show all the columns.
关于如何执行此操作的任何想法?
Any ideas about how to do this?
推荐答案
这里是带有水平滚动条的非常简单的网格(忽略虚拟化) http://demos.kendoui.com/web/grid/virtualization-remote-data.html .在您的网格上有一个宽度,或者是每列的父级和宽度,其总和超过实际网格的宽度,然后您将得到滚动条:
Here is quite straight forward grid with horizontal scrollbar (ignore the virtualization) http://demos.kendoui.com/web/grid/virtualization-remote-data.html.Have a width on your grid or it's parent and width for each column with their sum over the actual grid width then you get your scrollbar:
{ field: "OrderID", title: "Order ID", width: 60 },
(过去我做过很少的Kendo网格,并且从未遇到过这样的问题.听起来像您直接在html上设置列宽,我看不出Kendo还会如何脱离同步.)
(I did quite few Kendo grids in the past and never experienced such issue. Sounds like you setting up the column width directly on the html, I can't see how else would Kendo get out off sync.)
这篇关于剑道网格中的列线不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!