2

I have an issue with this library. First of all, to test the library, I made a simple example work with ul and li tags. It was straightforward. Then, I needed to do a table, and when converting my example to a table it didn't work.

Table is showed but I cannot move any row.

I'm using the cdn way.

I think is something what I missing.

html

<div id='app-example-drag' >
      <table class="table table-striped">
        <thead class="thead-dark">
          <tr>
            <th scope="col">Id</th>
            <th scope="col">Name</th>
            <th scope="col">Sport</th>
          </tr>
        </thead>
        <draggable v-model="list" tag="tbody">
          <tr v-for="item in list" :key="item.name">
            <td scope="row">{{ item.id }}</td>
            <td>{{ item.name }}</td>
            <td>{{ item.sport }}</td>
          </tr>
        </draggable>
      </table>
</div>

js

                    Vue.component('draggable',vuedraggable);

applicationExample = new Vue({
  el: '#app-example-drag',
  display: "Table",
  order: 8,
  data() {
    return {
      list: [
        { id: 1, name: "Abby", sport: "basket" },
        { id: 2, name: "Brooke", sport: "foot" },
        { id: 3, name: "Courtenay", sport: "volley" },
        { id: 4, name: "David", sport: "rugby" }
      ]
    };
  }
});

https://jsfiddle.net/0Luhd694/3/

Thanks in advance

1 Answer 1

3

I just ran into this same problem. I think it has something to with recent version. Replace the draggable element with a tbody and make is='draggable'.

<div id='app-example-drag' >
  <table class='table'>
      <thead>
          <tr><th scope='col'>description</th></tr>
        </thead>
        <tbody tag='tbody' v-model='lista1' is='draggable' group='items'>
          <tr v-for='item in lista1' :key='item.id'>
           <td scope='row'>{{item.description}}</td>
          </tr>
        </tbody>
    </table>
</div>

https://jsfiddle.net/oqf64kdx/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.