Commit 6e1d4dae authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

synchro mise en surbrillance du treeview

parent f051458d
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ export default {
    return {
      items: [],
      selectedCollection : null,
      selectedCollections: []
      emulate: false
    }
  },
  mounted() {
@@ -56,11 +56,26 @@ export default {
        document.querySelectorAll('.v-treeview-node--active')
            .forEach((elt) => elt.classList.remove('v-treeview-node--active'))//desactive current active
      }

      if(this.selectedCollection && this.selectedCollection.id !== this.currentCollection.id){
        document.querySelectorAll('.v-treeview-node--active')
            .forEach((elt) => elt.classList.remove('v-treeview-node--active'))//desactive current active
        try {
          const target = document.querySelector('#tree-item-' + this.currentCollection.id)
              .parentElement.parentElement;
          this.emulate = true;
          target.click();
        }
        // eslint-disable-next-line no-empty
        catch(e){}
      }
    }
  },
  methods: {
    async collectionClicked(c){
      this.selectedCollection = c;
      if(this.emulate)
        return;
      await this.fetchCollections(this.selectedCollection);
    },

@@ -103,7 +118,13 @@ export default {
      if(values.length !== 1)
        return false;
      this.selectedCollection = values[0];
      if(this.emulate){
        this.emulate = false;
        return;
      }
      else {
        this.$emit('tree-collection-selected', this.selectedCollection.id);
      }
    },

    loadHome(){