Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

134
Views
liquor-tree using before returns TypeError: Cannot read properties of undefined (reading 'indexOf')

using "vue": "^2.6.12", "liquor-tree": "^0.2.70"

attempting to append to tree in lifecycle hook 'created()'. Dom appears to be loaded and it appears that I have a good reference to the object, receiving "TypeError: Cannot read properties of undefined (reading 'indexOf')

from the docs at https://amsik.github.io/liquor-tree/#Tree-API Tree.before(criteria, node) Usage: This method has behaviour the same as Tree.append, but the point of insertion will be different (before found node or the start of the list (as root)).

There's just not a whole lot of working examples for liquor-tree or info on the web, any help? thank you

(I've added the entry to the tree via javascript but im not getting the typical reactivity that I assume I might get if I add it to the tree using the api)

 <tree
      v-if="loaded"
      ref="layerTree"
      class="flex-fill"
      :data="platformTree"
      :options="treeOptions"
      :filter="filter"
      @node:checked="toggleVisibility"
      @node:unchecked="toggleVisibility"
    >
      <span class="tree-text" slot-scope="{ node }">
        <template v-if="node.data.icon">
          <i :class="node.data.icon"></i>
          {{ node.text }}
        </template>

        <template v-else>
          {{ node.text }}
        </template>
      </span>
    </tree>

and then

 updated() {
    console.log("this.$refs.layerTree ", this.$refs.layerTree);
    this.appendData();
  },
  methods: {
    async appendData() {
      this.$refs.layerTree.before(
        { text: "IDENTIFICATION" }, // search criteria
        "New CHILD Node for My super Text" // this string will be converted to Node object with default state parameters
      );

enter image description here

enter image description here

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs