IgeUiElement

Method: applyStyle

Apply styles from a style data object. Usually you don't want to call this method directly but rather assign a style by name using the style() method, however it is not illegal practise to apply here if you wish if you have not defined a style by name and simply wish to apply style data directly.

Style property names must correspond to method names in the element class that the style is being applied to. You can see the default ui style methods available in the ./engine/extensions/IgeUi* files.

In the example below showing padding, you can see how the data assigned is passed to the "padding()" method as arguments, which is the same as calling "padding(10, 10, 10, 10);".

applyStyle (Object styleData)
  • ObjectstyleData The style object to apply. This object should contain key/value pairs where the key matches a method name and the value is the parameter to pass it.

Apply a background color

var elem = new IgeUiElement()
    .applyStyle({
        'backgroundColor': '#ffffff' // Set background color to white
    });

Apply padding with multiple arguments

var elem = new IgeUiElement()
    .applyStyle({
        'padding': [10, 10, 10, 10] // Set padding using multiple values
    });
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point