在EXTJS中包装标签

时间:2013-05-10 11:22:48

标签: css extjs

我无法在extjs中包装标签。我需要动态设置值,当值太长时,它会破坏布局(在我的情况下是表格布局)。

以下是我使用的代码:

{
    xtype: 'label',
    text: 'Bla bla bla bla bla',
    labelWidth: 20, //had tried width as well, but no use
    labelAlign: 'left',
    autoWidth: false,
    boxMinWidth: 10,
    boxMaxWidth: 20,
    colspan: 1,
    margin: '50 50 50 50'
}

我曾尝试修改默认的extjs css文件。添加了css

.x-form-label{
   white-space:normal
}
<{1>}中的

但没有用。

请帮忙。

2 个答案:

答案 0 :(得分:1)

在面板中包装长标签文本时,4.2.1中对我有用的是:

{
    xtype: 'label',
    width: '100%',
    text: 'xxxxxxxxxxxxx yyyyxx xxxx xxxx xxxxx xxxxx aaaa bbbb cccc dddd xxxxxxxxxxxxx yyyyxx xxxx xxxx xxxxx xxxxx aaaa bbbb cccc dddd ',
},

在Chrome,FF和IE11的应用中看起来像这样:

enter image description here

答案 1 :(得分:0)

这适用于Webkit。


{
    xtype: "label",
    id: "specificLabel"
}

.x-form-label#specificLabel {
    width: 20px;
    overflow: hidden;
}