Loj
Loj

Reputation: 437

Hierarchical datasets in Webix datalayout

I'm evaluating the Webix datalayout's structure and struggling to load data with the deep hierarchy.

If I use a grouplist within the datalayout, all works smoothly,

webix.ui({
  view:"datalayout",  
  rows:[
    { name:"$value", type:"header", template:"#panel#" },      
    { name:"any", view:"grouplist", template:"#value#" },    
  ],
  data:[
    { panel:"1", any:tree_data },
    { panel:"2", any:cars_data }
  ]
});

but when I'm trying to embed the tree, the default tree template is missing. Code snippet:

http://webix.com/snippet/8aa53125

Curious about this behavior. Maybe I've missed something important?

Upvotes: 2

Views: 111

Answers (1)

Aquatic
Aquatic

Reputation: 5144

Hierarchical components corrupts the original dataset after consuming. So you can feed the same data object only into a one hierarchical components, tree or grouplist.

//this will work
 rows:[
    { name:"$value", type:"header", template:"#panel#" },      
    { name:"any", view:"tree" }
  ],

//this one will not work
 rows:[
    { name:"$value", type:"header", template:"#panel#" },      
    { name:"any", view:"tree" }
  ],

If you really need to have both grouplist and tree to consume the same data, you can create them in normal layout and load data in component by using webix.copy, like next

 rows:[
    { view:"grouplist", id:"l1" },      
    { view:"tree", id:"t1" }
  ],
// and later

$$("l1").parse( webix.copy(data.any) );
$$("t1").parse( webix.copy(data.any) );

Upvotes: 4

Related Questions