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