In ExtJS 4, what's the difference between componentCls, cls and bodyCls ?
Panel is a container that has specific functionality and structural components that make it the perfect building block for application-oriented user interfaces. Panels are, by virtue of their inheritance from Ext. container. Container, capable of being configured with a layout, and containing child Components.
initComponent This method is invoked by the constructor. It is used to initialize data, set up configurations, and attach event handlers. beforeShow This method is invoked before the Component is shown. onShow Allows addition of behavior to the show operation.
A lightweight IDE optimized for building UI web tests with Selenium or Protractor.
autoEL. The autoEl config option lets you customize the Element that will encapsulate the Component.
ExtJS provide many options in styling the components. Each of these property have its place in implementing proper theming of your components.
cls: This is applied to the component's root element. Quoting from the docs:
An optional extra CSS class that will be added to this component's Element. This can be useful for adding customized styles to the component or any of its children using standard CSS rules.
By default, this is empty. If you need to style some child elements (by elements don't mean ExtJs components.. instead, they are HTML elements auto generated by the framework) of a component then, you can use this. For example, If you want to change background color of you's tab panel's inner area, you can do something like this:
.customCss x-box-inner {
background-color: yellow;
}
componentCls: This also gets applied to the component's root element. But, this property is meant to hold CSS styles for the component as a whole. Quoting from the docs:
CSS Class to be added to a components root level element to give distinction to it via styling.
From result point of view, both cls and componentCls gets applied to the root element. But, the are used for different purposes.
bodyCls: This is available for Panels. You will not find this styling for a button because, there is no body. If you want to provide custom styles for your panel's body region.. you can do so by setting this property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With