0

I have a button in a panel, and I need set a margin value, but the component not apply the value of margin, the EXT just ignore the margin property.

The follow code:

    Ext.define('CadastroEnsaioWTD.view.typecalculated.TypeCalculatedItem', {
    extend: 'Maestro.panel.Panel',

    requires: [
        'Maestro.form.Button',
        'Maestro.form.TextField',
        'Maestro.form.ComboBox'
    ],

    alias: 'widget.typecalculateditemview',
    layout: {
        type: 'hbox',
        align: 'middle'
    },
    width: '100%',
    height: '100%',

    initComponent: function () {

        var me = this;

        var config = {
            defaults: {
                width: 200,
                node: me.node,
                margin: '5 5 5 5',
                labelSeparator: '',
                xtype: 'maestro.form.textfield'
            },
            items: [
                {
                    xtype: 'label',
                    html: '<b>' + me.alias + '</b>',
                    width: 100
                },          
                {
                    width: 300,
                    xtype: 'maestro.form.combobox',
                    name: 'ENS_TIPO_DETERMINADO_CARACT'
                },
                {
                    xtype: 'maestro.form.combobox',
                    name: 'ENS_ENR_REFRIGERACAO_WTD'
                },
                {
                    name: 'ENS_PERC_CARGA_WTD'
                },
                {
                    name: 'ENS_COS_PHI'
                },
                {
                    width: 170,
                    xtype: 'maestro.form.combobox',
                    name: 'ENS_TIPO_ENR_APL_WTD'
                },
                {
                    width: 170,
                    xtype: 'maestro.form.combobox',
                    name: 'ENS_TIPO_ENR_CC_WTD'
                },
                {
                    name: 'ENS_ENR_TAP_TENSAO_APL'
                },
                {
                    name: 'ENS_ENR_TAP_TENSAO_CC'
                },
                {
                    name: 'ENS_POT_REF_WTD'
                },
                {
                    name: 'ENS_PERC_TENSAO_WTD'
                },
                {
                    width: 100,
                    name: 'ENS_TIPO_DETERMINADO_VAL'
                },
                {
                    width: 100,
                    xtype: 'maestro.form.combobox',
                    name: 'ENS_TIPO_DETERMINADO_UNID'
                },
                {
                    xtype: 'button',
                    text: '-',
                    width: 30,
                    style: 'border-radius: 7px;',
                    handler: function (btn) {
                        me.getObjectContextSynchronizer().executeServerRequest('deleteContextNode', [me.node]);
                    }
                }
            ]
        };
        Ext.apply(this, config);

        this.callParent();

    }

});

And if I set the value by console of chrome after the component rendered, using Ext.getCmp('xxxx').setMargin('15 0 0 0') does not work, but if I use Ext.getCmp('xxxx').getEl().setMargin('15 0 0 0') works.

Did I do something wrong?

João Pedro Schmitt
  • 1,046
  • 1
  • 11
  • 25

2 Answers2

0

you should use style:'margin:5px;' instead of using margin property

Ankit Chaudhary
  • 4,059
  • 1
  • 11
  • 23
0

You do it properly. I created working fiddle for you with button margins - Button & margin.

Try to play with it and repeat your issue.

Sergey Novikov
  • 4,096
  • 7
  • 33
  • 59