如何根据列的最大大小动态设置 YUI 数据表的宽度
我有一个 YUI 数据表,我将以下数据放入表中:
{key:"name", label:"name", editor: nameChoiceEditor},
{key:"group", label:"group", editor: groupChoiceEditor},
{key:"colony", label:"colony", width: 210, editor: colonyChoiceEditor},
...
这里 name
列的宽度设置为为该名称输入的字符的最大长度,与 group< /代码>。无论数据长度如何,
colony
的列宽均设置为 210。
我的问题是,当 name
列包含多个单词(如“odaiah chitukuri”)时,显示在两行中,如下所示:
odaiah
chitukuri
但是当它是一个单词(如“odaiahchitukuri”)时,它显示在一行中,意味着该列正在调整以适应单词。
我应该在单行中包含不同的单词。怎么做呢?
I have a YUI datatable and I am putting the following data in the table:
{key:"name", label:"name", editor: nameChoiceEditor},
{key:"group", label:"group", editor: groupChoiceEditor},
{key:"colony", label:"colony", width: 210, editor: colonyChoiceEditor},
...
Here the name
column's width is set to the maximum length of characters entered for that name, and the same with group
. colony
's column width is set to 210 irrespective of the length of the data.
My problem is when the name
column, having multiple words like "odaiah chitukuri", is showing in two lines like so:
odaiah
chitukuri
But when it is one word like "odaiahchitukuri" it is showing in a single line, meaning the column is adjusting to fit the word.
I should have the different words in sigle line. How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将“中断”空格替换为不间断空格。
尝试以下操作:
更改:
至:
Have the 'breaking' spaces replace with non-breaking spaces.
Try the following:
Change:
To:
我不确定您是否正在寻找一种始终将单词保留在一行上的解决方案。但一般来说,数据表在根据内部内容正确间隔列方面做得很好。但在某些情况下,我肯定必须手动设置列的宽度。以下是带有类 appicon 的列的示例:
请记住,一旦列中的单词数超出其定义的大小,它将始终移动到下一行。
I'm not sure if your looking for a solution that will always keep the words on a single line.. but generally speaking the datatable does a good job of spacing out the columns correctly based on the content inside. In certain cases though I've definitely had to set the width of a column manually. Here is an example for a column with class appicon:
Bare in mind once the number of words in the column stretches past it's defined size, it will always move to the next line.
在数据表列中定义:
width:100
width:"100px"
width:"100"
width:" 100em"
使用宽度:100
这样的话它对我来说工作得很好
In datatable column define :
width:100
width:"100px"
width:"100"
width:"100em"
Use width: 100
like that then its working fine for me