Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/449.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用包装标题时在顶部显示标题文本_Javascript_Kendo Ui_Kendo Grid - Fatal编程技术网

Javascript 使用包装标题时在顶部显示标题文本

Javascript 使用包装标题时在顶部显示标题文本,javascript,kendo-ui,kendo-grid,Javascript,Kendo Ui,Kendo Grid,我有一个剑道网格,其中有一些列如下: columns: [ { title: 'Test', field: 'SomeField', width: '200px' }, { title: 'Extra long example title', field: 'SomeOtherField', width: '100px', headerAttributes: {

我有一个剑道网格,其中有一些列如下:

columns: [
    {
        title: 'Test',
        field: 'SomeField',
        width: '200px'
    },
    {
        title: 'Extra long example title',
        field: 'SomeOtherField',
        width: '100px',
        headerAttributes: { style: "white-space: normal" }
    },
    ...
]
+------------+------------+
|            | Extra long |
|            | example    |
| Test       | title      |
+------------+------------+
+------------+------------+
| Test       | Extra long |
|            | example    |
|            | title      |
+------------+------------+
我的长标题没有任何问题。但每个不需要包装的较短列标题都显示在标题的底部,如下所示:

columns: [
    {
        title: 'Test',
        field: 'SomeField',
        width: '200px'
    },
    {
        title: 'Extra long example title',
        field: 'SomeOtherField',
        width: '100px',
        headerAttributes: { style: "white-space: normal" }
    },
    ...
]
+------------+------------+
|            | Extra long |
|            | example    |
| Test       | title      |
+------------+------------+
+------------+------------+
| Test       | Extra long |
|            | example    |
|            | title      |
+------------+------------+
但是,我希望标题位于标题顶部,如下所示:

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

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

阿尔特姆赫的评论就是解决我问题的方法。我只需将
垂直对齐:top
添加到我的
标题属性
,以显示单元格顶部的标题。

ArtemKh的注释就是我问题的解决方案。我只需将
垂直对齐:顶部
添加到我的
标题属性
,以显示单元格顶部的标题。

垂直对齐:顶部?@ArtemKh Omg是的,没有想到…@ArtemKh请将其作为答案发布,以获得代表。垂直对齐:顶部?@ArtemKh Omg是的,没想到…@ArtemKh请把它作为答案发布,以获得代表。