开发者

ExtJS: Preventing Checkboxes inheriting the hideLabel attribute of their parent CheckboxGroup

I am trying to display checkboxes within checkboxgroups. To keep them lined up with the other fields in the form, I want to disable the group's fieldLabe开发者_运维知识库l, while keeping each checkbox's individual fieldLabel. However, if I set hideLabel to true for the checkboxgroup, the field labels for the individual checkboxes disappear also, even if I explicitly set hideLabel to false.

Is this going to be possible? Thanks for any help.

Edit: As requested, some code:

config = {
    xtype: 'checkboxgroup',
    hideLabel: true,
    columns: 1,
    items: [{
        fieldLabel: 'Item 1', 
        hideLabel: false
    }, {
        fieldLabel: 'Item 2', 
        hideLabel: false
    }]
};


Are you defining a boxLabel on the checkboxes? You should define the boxLabels on the combos and set hideLabel to true on the checkboxgroup.


I solved this using some custom CSS. Instead of setting display: none to any label elements that are descendants of a container with the x-hide-label class, it is only applied to labels that are direct children of such a container.

.x-hide-label label.x-form-item-label {
    display: inline;
}

.x-hide-label > label.x-form-item-label {
    display: none;
}

It's not perfect, but it works for me. Checkboxes and their labels remain aligned properly with all other form elements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜