简体   繁体   English

Kendo UI Angular Grid - 只需要显示一行内容

[英]Kendo UI Angular Grid - need to only show one line of content

I am using the Kendo UI grid for Angular and have a scenario where one of the grid columns has a lot of text data, but I don't want the text to wrap.我正在使用 Angular 的 Kendo UI 网格,并且有一个场景,其中一个网格列有很多文本数据,但我不希望文本换行。 I want all the rows the same height.我希望所有行都具有相同的高度。

I tried adding this to the SCSS file for my component:我尝试将其添加到我的组件的 SCSS 文件中:

 .k-grid { background-color: green; } .k-grid tbody tr { height: 40px; } .k-grid tbody tr td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

The background is green (I put that there to rule out any issues with my SCSS not being built correctly) but the other styles seem to be getting ignored.背景是绿色的(我把它放在那里是为了排除我的 SCSS 没有正确构建的任何问题),但其他样式似乎被忽略了。 I looked at the elements in Chrome debugger, and the rules for the row stuff aren't being referenced at all, which makes me think these selectors don't work for the Angular version.我查看了 Chrome 调试器中的元素,根本没有引用行内容的规则,这让我认为这些选择器不适用于 Angular 版本。 There's plenty of documentation for the jQuery version (which is where I got this from) but nothing for the Angular control. jQuery 版本有很多文档(这是我从那里得到的),但没有关于 Angular 控件的文档。

Does anyone know what I'm doing wrong or have any ideas how to make this work?有谁知道我做错了什么或有任何想法如何使这项工作?

Thanks, James谢谢,詹姆斯

Try this:试试这个:

/deep/ .k-grid tbody tr {
    height: 40px;
}

/deep/ .k-grid tbody tr td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
 }

Edit:编辑:
For more info, you can read about it in the documentation here .有关更多信息,您可以在此处的文档中阅读相关信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM