PDA

View Full Version : [CLOSED] add panel before render buttom on initComponent



abadeleandro
Feb 12, 2014, 5:24 PM
how can I add a panel before creating the button in initComponent method of Button.js (override) file.
rum always creates one additional button panel
sorry my english is not good.

----- panel
--------- button

geoffrey.mcgill
Feb 12, 2014, 5:51 PM
how add panel before render buttom on initComponent or in class Button.js override

Please rephrase your question. I'm not 100% sure what you are asking.

abadeleandro
Feb 12, 2014, 6:03 PM
how can I add a panel before creating the button in initComponent method of Button.js (override) file.
rum always creates one additional button panel
sorry my english is not good.

----- panel
--------- button

geoffrey.mcgill
Feb 12, 2014, 6:32 PM
how can I add a panel before creating the button in initComponent method of Button.js (override) file.
rum always creates one additional button panel
sorry my english is not good.

----- panel
--------- button

Can you explain why you would want to do this? Why put a Panel before every Button? I'm pretty sure this will not work under many scenarios.

abadeleandro
Feb 12, 2014, 6:36 PM
Can you explain why you would want to do this? Why put a Panel before every Button? I'm pretty sure this will not work under many scenarios.

because I'm doing a customization and would want to have a <div> button to run before my class (custom-css) it


<div class="mybtngroup"> >>> panel

<botao> >> button

</ div>

Daniil
Feb 13, 2014, 3:21 AM
What kind of customization are you doing? You can apply a CSS class to a Button via its Cls property.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.button.Button-cfg-cls

We recommend not to use a Panel for that. It is very-very heavy weight and, as Geoffrey already said, it is just not going to work well.

abadeleandro
Feb 13, 2014, 12:54 PM
What kind of customization are you doing? You can apply a CSS class to a Button via its Cls property.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.button.Button-cfg-cls

We recommend not to use a Panel for that. It is very-very heavy weight and, as Geoffrey already said, it is just not going to work well.

In some cases not all need a
<div>
<a> before so I thought the panel, but if you have another way to accept suggestions, cls already used the more accurate div tb'm doing a customization for my system.

Daniil
Feb 13, 2014, 1:07 PM
Please clarify why do you need those <div> and <a> sometimes?

Even if it would be easy possible with Buttons, we would not recommend to do it, because each Button already renders some HTML markup which is quite complex.

abadeleandro
Feb 13, 2014, 1:18 PM
Please clarify why do you need those <div> and <a> sometimes?

Even if it would be easy possible with Buttons, we would not recommend to do it, because each Button already renders some HTML markup which is quite complex.


in some cases I have a custom button with some different css my css asks a div before the button, customized layout.

Daniil
Feb 14, 2014, 2:57 AM
Ok, if you want to override the default Button, it should look like this:

Ext.button.Button.override({
initComponent: function() {
// your code
}
});

Still we would suggest to change the CSS part.