javascript - 如何将剑道网格标题文本保持在顶部?

标签 javascript css kendo-grid

我正在使用剑道数据网格,其中我对标题文本有一个小问题,一些标题标签有很长的文本,因为标题文本看起来不太好,因为我正在使用断线并使标题变大,所以文本很小没有正确对齐。有没有办法将所有标题放置在顶部,以便看起来一致?

gridConfig.js

columns : [

                {
                    field : '',
                    title : 'Action',
                    width: '80px'
                    },


                }, {
                    field : 'riskAssessmentChallengeKey',
                    title : 'Challenge ID',
                    width: '100px',
                    headerAttributes: {
                        style: 'height: auto; white-space: normal'
                    }

                },
                 {
                  field : 'createWorkerText',
                  title : 'Created By',
                  width: '120px',
                  headerAttributes: {
                      style: 'height: auto; white-space: normal'
                                }

              },
]

最佳答案

display: table-cell 的一些变体;垂直对齐:顶部;文本对齐:居中

或者也许显示:-webkit-box; -webkit-box-pack:中心; -webkit-box-align:顶部;

我也可能会在 CSS fie 中执行此操作,并在 headerAtrributes 中添加一个类

“class”:“mygrid-header-cell”,

然后你可以将css放在它所属的css文件中。

编辑请注意,您也可以像这样执行CSS:

headerAttributes: { "class": "mygrid-header-cell"}

和CSS

.k-grid-header .mygrid-header-cell {
  text-align: center;
  display: table-cell; vertical-align: top;
}
.k-grid-header .wrap-header {
  height: auto;
  overflow: visible;
  white-space: normal;
}

关于javascript - 如何将剑道网格标题文本保持在顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35436851/

相关文章:

jquery - Kendo UI Grid 单击下拉菜单激活

html - 在没有编辑器的情况下渲染 ckeditor html

mvvm - 带有声明性编辑器模板的 Kendo 网格

javascript - 函数调用但元素消失

JavaScript 幻灯片重叠问题

jquery - translate ease for translate only 首次在 iPhone 上流畅

html - 一个非常奇怪的图像/图标文件(单个文件包含具有 3 种不同尺寸的相同图像)

c# - Kendo Grid 将所有数据打印到 Excel,而不仅仅是可见数据

javascript - 有没有更好的方法来设置和从 LocalStorage 获取?

javascript - 覆盖 Highcharts X 轴