如何设置 EXTJS Combobox 标签宽度

How to set EXTJS Combobox label width

我正在尝试让组合框的标签在下面的示例中正确显示。我正试图让它在 Sencha Fiddle 中工作。文本如果太长,将被截断。

Ext.application({
    name : 'Fiddle',

    launch : function() {


        // The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data : [
        {"abbr":"AL", "name":"Alabama"},
        {"abbr":"AK", "name":"Alaska"},
        {"abbr":"AZ", "name":"Arizona"}
        //...
    ]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
    fieldLabel: 'Reaaaaaaaaaaaaaaallllllllly long',
    fieldlabelStyle: 'width:600px',//doesn't do anything
    store: states,
    queryMode: 'local',
    displayField: 'name',
    valueField: 'abbr',
    renderTo: Ext.getBody()
});
    }
});

试试 labelStyle

Ext.application({
    name : 'Fiddle',

    launch : function() {
        // The data store containing the list of states
        var states = Ext.create('Ext.data.Store', {
            fields: ['abbr', 'name'],
            data : [
                {"abbr":"AL", "name":"Alabama"},
                {"abbr":"AK", "name":"Alaska"},
                {"abbr":"AZ", "name":"Arizona"}
                //...
            ]
        });

        // Create the combo box, attached to the states data store
        Ext.create('Ext.form.ComboBox', {
            fieldLabel: 'Reaaaaaaaaaaaaaaallllllllly long',
            labelStyle: 'width:600px',
            //fieldlabelStyle: 'width:600px',//doesn't do anything
            store: states,
            queryMode: 'local',
            displayField: 'name',
            valueField: 'abbr',
            renderTo: Ext.getBody()
        });
    }
});

为此使用 labelWidth: 配置。像这样定义

 labelWidth: '60%',