K
K
Konstantin Malyarov2018-05-31 18:54:09
Vue.js
Konstantin Malyarov, 2018-05-31 18:54:09

Why doesn't VueJS (SortableJS) work on generated list?

There is a first list where objects are represented:

<draggable v-model="operations" :options="{group:'operations'}"
                                   class="bg-light border border-dark rounded"
                                   style="padding: 5px; margin: 1px">
                            <div v-for="operation in operations"
                                 :key="operation.id"
                                 v-if="(operation.is_planed === false) && (operation.is_completed === false)"
                                 class="border rounded"
                                 style="margin: 1px">
                                Дата: <b>{>operation.date_operation<}</b>
                                <br>Анестезия: <b>{>operation.anesthesia.short_name<}</b> Продолжительность: <b>{>operation.anesthesia_time<}</b>
                                <br>Фамилия: <b>{>operation.last_name<}</b>
                                <br>Диагноз: <b>{>operation.diagnosis<}</b>
                                <br>Название операции: <b>{>operation.operation_name<}</b>
                            </div>
                        </draggable>

5b101a3e0b3ad146174819.png
There is a second list where objects from the first list are dragged:
<b-tab v-for="(rooms, day) in period"
                                   v-if="moment(moment().format('YYYY-MM-DD')).isSameOrBefore(moment(day).format('YYYY-MM-DD'))"
                                   :title="day">
                                <div v-for="(room, room_index) in rooms">
                                    <draggable v-model="period[day][room_index]"
                                               :options="{group:'operations'}"
                                               class="bg-light border border-dark rounded"
                                               style="padding: 5px; margin: 3px">
                                        <div v-for="(operation, index) in room"
                                             :key="operation.id"
                                             class="border border-dark rounded"
                                             style="margin: 1px">
                                            Дата: <b>{>operation.date_operation<}</b>
                                            Операционная: <b>{>room_index | addCount(1)<}</b>
                                            Очередь: <b>{>index | addCount(1)<}</b>
                                            <br>Анестезия: <b>{>operation.anesthesia.short_name<}</b> Продолжительность:
                                            <b>{>operation.anesthesia_time<}</b>
                                            <br>Фамилия: <b>{>operation.last_name<}</b>
                                            <br>Диагноз: <b>{>operation.diagnosis<}</b>
                                            <br>Название операции: <b>{>operation.operation_name<}</b>
                                        </div>
                                    </draggable>
                                </div>
                            </b-tab>

5b101a4bc537b336332273.png
By dragging from the first list to the second, I can only return to the first, but I cannot sort inside the second. How to fix it?
5b101ac2b7dd6239478493.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question