Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!

tnhnet priority asked 2 years ago


Expected behavior

bind treeview to v-model, update a variable with selected elements nameson @select event returns the items selected by name

Actual behavior

using v-model doesn't workthe @select event returns a list of html elements. my question is how do I get the list of selected names ?


Bartosz Cylwik staff answered 2 years ago


Hi! To get the list of selected names you can listen for select event on MDBTreeview component. When any of the treeview checkboxes are changed, select emit is sent.

You can see the code below to check how to use it.

<template>
    <MDBTreeview selectable @select="handleActive">
      <ul>
        <li>One</li>
        <li>Two</li>
        <li>Three</li>
      </ul>
    </MDBTreeview>
</template>

<script setup>
    const handleActive = (value) => {
        console.log(value.items);
    };
</script>

Best Regards!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 3.0.0
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: No