Cannot read property 'isIE6' of undefined


#1

Hello,

I installed the npm package “dhtmlx-suite” in a vue.js project and tried to implement a tree view with the given samples. In the console I received the following message “Cannot read property ‘isIE6’ of undefined”. Could you please help me to solve this problem.

“TreeView.vue”

template>
  <div id="treeView"></div>
</template>

<script>
import "dhtmlx-suite/sources/dhtmlxTreeView/codebase/dhtmlxtreeview.js";

export default {
  name: "TreeView",
  data() {
    return {
      // treeViewObject: new dhtmlXTreeViewObject("treeView")
      treeViewObject: null
    };
  },
  mounted() {
    this.initializeTreeView();
  },
  methods: {
    initializeTreeView() {
      // this.treeViewObject.loadStruct("treeView.json");
      this.treeViewObject = new dhtmlxTreeViewObject({
        parent: "treeView",
        item: "treeview.json"
      });
    }
  }
};
</script>
<style>
@import "~dhtmlx-suite/sources/dhtmlxTreeView/codebase/skins/dhtmlxtreeview_material.css";
</style>

“Management.vue”

<template>
  <div>
    <tree-view></tree-view>
  </div>
</template>

Best Regards
A. Mehlen


#2

In case of using the “sources” files you also need to include the dhtmlxcommon.js file.


#3
<template>
  <div id="customProjectTreeView">
    <div id="treeView"></div>
  </div>
</template>

<script>
import "dhtmlx-suite/sources/dhtmlxCommon/codebase/dhtmlxcommon.js";
import "dhtmlx-suite/sources/dhtmlxTreeView/codebase/dhtmlxtreeview.js";

export default {
  name: "TreeView",
  data() {
    return {
      treeViewObject: new dhtmlXTreeView("treeView"),
      treeData: [
        {
          id: 1,
          text: "Books",
          open: 1,
          items: [
            {
              id: 5,
              text: "Stephen King",
              items: [
                { id: 11, text: "The Dead Zone" },
                { id: 12, text: "The Running Man" },
                { id: 13, text: "The Talisman" },
                { id: 14, text: "The Tommyknockers" },
                { id: 15, text: "The Green Mile" },
                { id: 16, text: "The Girl Who Loved Tom Gordon" },
                { id: 17, text: "Dreamcatcher" },
                { id: 18, text: "Blood and Smoke" }
              ]
            },
            {
              id: 6,
              text: "Herbert Wells",
              open: 1,
              items: [
                { id: 19, text: "The Time Machine" },
                { id: 20, text: "The Island of Doctor Moreau" },
                { id: 21, text: "The Invisible Man" },
                { id: 22, text: "The First Men in the Moon" },
                { id: 23, text: "The War of the Worlds" }
              ]
            },
            {
              id: 7,
              text: "Mark Twen",
              items: [
                { id: 24, text: "The Adventures of Tom Sawyer" },
                { id: 25, text: "The Prince and the Pauper" },
                { id: 26, text: "Adventures of Huckleberry Finn" },
                { id: 27, text: "Tom Sawyer Abroad" },
                { id: 28, text: "Tom Sawyer Detective" },
                { id: 29, text: "Personal Recollections of Joan of Arc" }
              ]
            }
          ]
        },
        {
          id: 2,
          text: "Misc",
          items: [
            { id: 8, text: "Turned at Dark / C. C. Hunter" },
            { id: 9, text: "Daire Meets Ever / Alyson Noël" },
            { id: 10, text: "Socs and Greasers / Rob Lowe" }
          ]
        },
        { id: 3, text: "Privacy and Terms.pdf" },
        { id: 4, text: "Licence Agreement.pdf" }
      ]
    };
  },
  mounted() {
    this.initializeTreeView();
  },
  methods: {
    initializeTreeView() {
      this.treeViewObject.loadStruct(this.treeData);
    }
  }
};
</script>
<style>
@import "~dhtmlx-suite/sources/dhtmlxTreeView/codebase/skins/dhtmlxtreeview_material.css";
</style>

I updated my code with the library like you said. But this time in the console I get the message “[Vue warn]: Error in data(): “ReferenceError: dhtmlXTreeView is not defined””

Could you please check my other post!

Best Regards.