A
A
asferot2018-10-15 12:33:09
JavaScript
asferot, 2018-10-15 12:33:09

How to make that when choosing an option in one select, the records in another select are sorted?

How to make it so that when a record with a certain index is selected in the selectedFilial, the records with the selectedManager indexes are selected.
Suppose We select a branch with index = 1 in selectedFilial, and we are offered managers in the selectedManager with indexes set by us, correspond to branch 1. When choosing branch 1, managers 1,2,3, etc. are offered5bc45ead316a2655868178.png

+b.b-block-menu(v-if="showmenu")
            +b.DIV.select-container-menu-filial
                +b.P.vybor-filial Филиал
                +b.P.select-menu-city Выбрано: {{selectedFilial}}
                +b.SELECT.select-menu-filials(v-model="selectedFilial")
                    +e.OPTION.filial(value="" selected disabled hidden) Выберите пункт
                    +e.OPTION.filial(v-for="(filial, index) in filials" v-bind:value="filial.f5001") {{filial.f5001}}
            +b.DIV.select-container-managers
                +b.P.vybor-maganer Менеджер
                +b.P.select-name Выбрано: {{selectedManager}}
                +b.SELECT.select-filials(v-model="selectedManager")
                    +e.OPTION.filial(value="" selected disabled hidden) Выберите пункт
                    +e.OPTION.filial(v-for="(manager, index) in managers" v-bind:value="manager.f483" ) {{index}}: {{manager.f483}}
            +e.P.name-project Проект:
            toggle-button(id="changed-font" class="switch_project" :value="true"
                :labels="{checked: 'Открыто', unchecked: 'Закрыто'}"
                :width= 85
                :color= "{checked:'#4DB6AC',unchecked: '#AED581'}"
                :height= 24)
            +b.DIV.radiobuttons-block
                +e.P.check-item Выбрано: {{positionzayavka}}
                +e.INPUT.item-radio(type="radio" value="Товары" v-model="positionzayavka" id="onezayavka" name="checkzayavka")
                +e.LABEL.item-label(for="onezayavka") Товары
                +e.INPUT.item-radio(type="radio" value="Услуги" v-model="positionzayavka" id="twozayavka" name="checkzayavka")
                +e.LABEL.item-label(for="twozayavka") Услуги
                +e.INPUT.item-radio(type="radio" value="Тов+усл" v-model="positionzayavka" id="treezayavka" name="checkzayavka")
                +e.LABEL.item-label(for="treezayavka") Тов+усл
            +e.BUTTON(@click="reset").clear Сброс

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Rak, 2018-10-27
@rak1996

@input="sortOtherSelect" on the first selector
In the function, you will have a value available, use it to sort another array.
Or as contaminavit suggested, add a watcher to the value of the first selector and sort the second array however you like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question