Vue.draggable: Drop into multiple dynamic lists

Created on 25 Sep 2018  路  5Comments  路  Source: SortableJS/Vue.Draggable

Hello guys!
Thanks for this great job!

I麓m trying to drag an item from a list to another like "Trello".
The other lists are dynamic, so I麓ll never know the number of lists will be rendered.
Let me try to explain better:

Scenario:

On the left of the screen, there is this list of items for the manager to distribute for the employers. The other part of the screen are lists of employers (which I麓ll never know the right amount) so the manager can drag an item to a single employer and save to the data table on droping.

The problem I am facing is that when I drag to one employer, all the employers receive the same item. And the second issue is that I can麓t which event I麓ll use to trigger the AJAX request to save to the data base.

Let麓s see some code:
This image shows what happens when I drag and drop an item to the first guy!

captura de tela 2018-09-25 as 11 01 37

The blade file:

<div class="row" >
          <div class="col-md-12 p20">
          </div>
          <div class="col-md-3  col-sm-3">
            <h5>Leads</h5>
            <ul class="list-group drag p10">
                <draggable class="dragArea"
                           :options="{group:'ITEMS'}"
                           v-model="leads">
                    <li class="list-group-item"
                        v-for="lead, index in leads"
                        :key="lead.no">
                        <span class="badge">No.@{{ lead.id }}</span>
                        <label>
                            @{{ lead.nome }}
                        </label>
                    </li>
                </draggable>
            </ul>
          </div>
          <div class="col-md-3  col-sm-3" v-for="corretor, index in corretores">
          <h5>@{{ corretor.name }}</h5>
              <ul class="list-group drag p10">
                  <draggable class="dragArea"
                             :options="{group:'ITEMS'}"
                             v-model="corretoresComLeads">
                      <li class="list-group-item" v-for="lead, index in corretoresComLeads">
                          <span class="badge">No.@{{ lead.id }}</span>
                        <label>
                            @{{ lead.nome }}
                        </label>
                        <span class="del" v-on:click="deleteItem(lead, index, '2')"><i class="fa fa-times"></i></span>
                      </li>
                  </draggable>
              </ul>
          </div>
        </div>

The script part of the blade file:
````
@section('scripts')

@endsection
```

Most helpful comment

Looks like @David-Desmaisons already answered the question in another thread.

<div v-for="list in lists">
    <draggable v-model="list">
          ......
     </draggable>
<div>

It worked for me.

All 5 comments

Please address this on stackoverflow as per contributing guideline.

How do I do it?

Did someone resolve this?

Nobody solved it, even the member @David-Desmaisons . You see this, bro, but i can't image how can you see it and don't help us.

Looks like @David-Desmaisons already answered the question in another thread.

<div v-for="list in lists">
    <draggable v-model="list">
          ......
     </draggable>
<div>

It worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Stetzon picture Stetzon  路  3Comments

fedenko picture fedenko  路  3Comments

rootman picture rootman  路  3Comments

tomdong picture tomdong  路  3Comments

Kgwkgwkgw picture Kgwkgwkgw  路  3Comments