Redefinition of components

Problem

How to 'redraw' initialized components if you'd like to change something?

Solution

Generally, to redefine some property of a component after it has been initialized (doesn't matter the type a property has: string, number, object etc.) you need to use the method define():

$$("myGrid").define("css","my_style");
$$("myGrid").refresh();

where

  • myGrid - the id of a component;
  • css - the name of a property;
  • my_style - the new value of a property.

How you can get the value of a property

The current value of any property can be gotten through $$(“component_id”).config.propertyName:

var width = $$("myList").config.width;

Some properties are objects. In this case after $$(“component_id”).config you should write the complete dependency property inheritance chain:

var width = $$('myGrid').config.fields['field_1'].width;