Forum Stats

  • 3,872,423 Users
  • 2,266,419 Discussions
  • 7,911,196 Comments

Discussions

OJ-Tree-View: Error JET TreeView nodes should not have duplicated keys: undefined

User_D433J
User_D433J Member Posts: 5 Green Ribbon

Hi All,

I'm getting an error message with my tree view. Below is a small sample code I wrote to test dynamically populating a tree-view.

objData = ko.observableArray([

      {title:"Default", id:"default"}

    ]);   

    objData.push({title: "Print", id: "print"});

     

    const newNode = objData.slice(0,1);

    newNode["children"] = new ko.observableArray([{title: "Child1", id: "child1"}]);

    objData.splice(0, 1, newNode); 

  

    self.data = ko.observable(new ArrayTreeDataProvider(objData, { keyAttributes: "id" }));


However when I expand the first tree node, it gives me an error nodes should not have duplicated keys. Also the first value no longer reads default. Where am I going wrong with the code? Thanks.

Tagged:

Answers