the values of cells and rows are "undefined"

I read the documentation and found this method to get the value of a property:

var width = $$(“myList”).config.width;

but i found i cannot get the value of cells or rows this way:

var cells = $$(“mview”).config.cells;
var rows = $$(“layout”).config.rows;

the values of them both are “undefined”…

i want to dynamically add cells /rows or other controls, but i don’t know how to do…

i mean that if there is a way to add controls dynamically, indeed ?

errr…i think i mean components ,not just controls…
and if i wanna replace some views/components and use the new id (use define()),
and after that, when i change it back … it seems that through its parent , i cant’t visit the properties of the new component which have the old id…

There is no special API to get child views in rows and cols collections. You can assign ID to them and access them by id.

As for dynamical adding view - the recommended way is to define all possible views and only show|hide them when necessary. If you still want to change them dynamically, you can use dhx.ui command to replace some view with new one

[code]dhx.ui( config, id_of_parent, id_of_view);
//or
dhx.ui( config, id_of_parent, index_of_view);

//will replace first child of layout with new view
dhx.ui({ view:“list” }, “layout_id”, 0);[/code]

thx for reply :slight_smile:

the documentation provide the method to get the value of a property…and cells/rows are properties of the components, so i try to get the value of them this way:

var cells = $$(“mview”).config.cells;
var rows = $$(“layout”).config.rows;

in debug mode, i can see the name of the two properties using this way…
but the values of them are null…

however, it’s feasible to use $$(“mview”).define(“cells”,[json data]); to replace cells.

what i want to confirm is … does the documentation describe not that accurately ?

It works for number|string properties, but it doesn’t work for views.

View always can be located by its id - this isrecommended approach, providing paths like some.config.rows[1].config.cols[2] is much less error-prone, so it was not implemented. ( still we will add some API to get sub cells to the next update )

As for redefining views, it is not recommended to use as well. While it possible to do, through dhx.ui usage, in most cases it will be better to use multiview and just show one of pre-created cells insted of recreating views in the same layout. ( because dhx touch do not render hidden views - there is no performance drawbacks in case of multiview usage )