如何将 Dojox Datagrid 行高设置为单行
我正在尝试将 Dojox 1.3 Datagrid 的高度固定为单行(如 Excel)。 当前的功能是当可用数据多于单行所能容纳的数据时,自动增加行的高度。
有没有一种简单的方法可以实现这一点? 考虑到这是电子表格的默认行为,它似乎应该内置于数据网格的功能中。
谢谢您的帮助
I'm trying to fix the height of a Dojox 1.3 Datagrid to a single line (like Excel). The current functionality is to automatically increase the row's height when more data than will fit into a single line is available.
Is there an easy way to accomplish this? It seems like it should be built in functionality for a datagrid, conisidering that this is the default behavior for spreadsheets.
Thanks for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无法设置高度,但可以调整宽度。 如果您很清楚单元格通常需要多宽才能将字符串放在一行上,您可以将其设置在 << th> 元素以最大化适合一行的行数。
希望这可以帮助。
You can't set the height, but you can adjust the width. If you have a good idea how wide your cell will normally need to be in order to fit the string on one line you can set it in your < th > element to maximize the number of rows that fit onto one line.
Hope this helps.
发现了一个黑客!
使用它作为列格式化程序:
这只是一个黑客,我发现行选择器存在一些问题。 但无论如何,希望这对你们有帮助。
Found a hack!
use this as the column formatter:
This is just a hack and I'm seeing some problem with the row selector. But anyway, hope this help you guys.
我想你可以。
这是我一直在尝试的:
在 .dojoxGridCellContent 类中,添加:
white-space:nowrap;
溢出:隐藏;
对于我的“挤压/展开”函数,我使用一个小函数来动态更改类属性,然后重新绘制网格。
我坚信需要能够将行(在 Excel 和 html 中)压缩到 1“行”高,以便于垂直视觉扫描(根据需要截断单元格内容),然后能够再次展开它们以查看任何特定行的单元格中的完整内容。
如果任何给定单元格中的文本数量不同,则手动将列的大小设置为足够宽以适合任何给定单元格中的所有可能文本是一个糟糕的解决方案。 对于生产力应用程序来说,非功能性空白是敌人。
我希望 Dojo 中有一种内置方法来完成这项有用的事情(也解决了常年出现的跨浏览器条件省略问题)。
I think you can.
Here is what I've been experimenting with:
In class .dojoxGridCellContent, add:
white-space:nowrap;
overflow:hidden;
For my "Squeeze/Expand" functions, I use a little function to dynamically change a class attribute and then I re-paint the grid.
I'm a firm believer in the need to be able to crunch rows (both in Excel and in html) down to 1 "row" high in order to facilitate vertical visual scanning (truncating cell contents as necessary) and then to be able to expand them out again to see the full contents in a cell on any particular row.
Manually sizing the column to be wide enough to fit all the possible text in any given cell is a terrible solution if you have variable amounts of text in any given cell. For productivity apps, non-functional white space is the enemy.
I wish there were a way built in to Dojo to do this useful thing (also solving the perennial cross-browser conditional ellipses thing).