使用换行标题时,在顶部显示标题文本

Show header text on top when using wrapped headers

本文关键字:标题 顶部 显示 文本 换行      更新时间:2023-09-26

我有一个剑道网格,其中有一些列,像这样:

columns: [
    {
        title: 'Test',
        field: 'SomeField',
        width: '200px'
    },
    {
        title: 'Extra long example title',
        field: 'SomeOtherField',
        width: '100px',
        headerAttributes: { style: "white-space: normal" }
    },
    ...
]

我的长标题没有任何问题地被包装起来。但是每个不需要换行的较短的列标题都显示在header的底部,像这样:

+------------+------------+
|            | Extra long |
|            | example    |
| Test       | title      |
+------------+------------+

然而,我想在标题的顶部有这样的标题:

+------------+------------+
| Test       | Extra long |
|            | example    |
|            | title      |
+------------+------------+

我尝试将headerAttributes: { style: "margin-top: 0" }添加到第一列,但它没有改变任何东西。我怎样才能做到这一点呢?

ArtemKh的评论解决了我的问题。我只需要将vertical-align: top添加到我的headerAttributes以显示单元格顶部的标题。