如何在extjs中隐藏水平线

How to hide horizontal line in extjs

this.horizontalLine = {
    xtype: 'box',
    hidden: false,
    autoEl : {
        tag : 'hr'
    }
};

我想隐藏这条横线。但是

this.horizontalLine.hide()

未定义。 我也尝试使用 this.horizontalLine.hidden = true。在这种情况下,hidden 属性 设置为 true 但该行仍然可见。还有其他方法吗?

你试过了吗this.horizontalLine.hidden = true;

我通过在面板中放置水平线并隐藏面板来解决问题。

    this.rulesLabel = new Ext.form.Label({
    text : 'Rules:',
    style : 'font-size:11px;font-weight:bold;color:#15428B;padding-right:10px;padding-top:50px; margin-left:10px;'
});

this.horizontalLine = {
    xtype: 'box',
    autoEl : {
        tag : 'hr'
    }
};

this.lineHolder = new Ext.Panel({
    id: 'lineHolder',
    hidden : true,
    border: false,
    layout : 'form',
    bodyStyle : 'padding-top:10px;',
    items : [{xtype: 'box'},this.rulesLabel, this.horizontalLine]
});

我用this.lineHolder.show()this.lineHolder.hide()分别显示和隐藏线。

Ext.Component 有一个 hide() 方法,所以你的代码应该可以工作。

查看工作示例:https://fiddle.sencha.com/#fiddle/ku7