The arrow's icon of treetable lost

edited September 2019 in Technical questions

Hi, webix team I have problem with treetable.
this is my example code that worked.

https://snippet.webix.com/7j01gqht

but I got problem if I split the part of code to models folder


//models/mydata.js

const mydata = new webix.DataCollection({
    
    data:{"parent":0,"data":[{"value":"Layout branch","state":"in progress","hours":120,"parent":0,"data":[{"_id":3,"has_kids":0,"value":"Accordion","state":"finalized","hours":42,"parent":1,"data":[]},{"_id":4,"has_kids":0,"value":"Multiview","state":"finalized","hours":34,"parent":1,"data":[]}],"id":1},{"value":"Data branch","state":"in progress","hours":150,"parent":0,"data":[{"_id":5,"has_kids":0,"value":"List","state":"finalized","hours":50,"parent":2,"data":[]}],"id":2},{"value":"Calendar","state":"planing","hours":0,"parent":0,"data":[],"id":6}]}
});

export function getData(){
    return mydata;
}


import {getData} from "models/mydata";

class TreeView extends JetView {
  config () {
    return {
      view:"treetable", 
      autoConfig:true,
      columns:[
        { id:"id",  header:"", css:{"text-align":"right"},      width:50},
        { id:"value",   header:"Title", width:250,
         template:"{common.treetable()} #value#" },
        { id:"state",   header:"State", width:100},
        { id:"hours",   header:"Hours", width:100}
      ],
      autoheight:true,
      autowidth:true,    
       
    };
  }
  init(view){
    view.parse(getData());
  }
  
}

Parent Data in treetable still available. But when I switch the side menu list ("Start", "Data", & "Treetable") and I click "Treetable" back, the arrow's icon of treetable lost. And I can't see Child Data of Parent again.
I have to press Ctrl + R or F5 to get treetable normally.

Is this a bug or something else that I missed ? thx for help.

Tagged:

Comments

  • edited September 2019

    Hey @frizky, use a TreeCollection instead, DataCollection is meant for storing the non-hierarchical data, which is why it won't work in your case. It would look something like this:

    const mydata = new webix.TreeCollection({
    
       data: [...]
    
    });
    
    export function getData(){
        return mydata;
    }
    

    I've tried running your sample locally, and the issue was gone once the TreeCollection was used.

  • thx @Dzmitry , it's worked.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!