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请把它作为答案发布,以获得代表。