Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close form multi select on button click #2304

Open
abhimanusharma opened this issue Feb 11, 2021 · 0 comments
Open

Close form multi select on button click #2304

abhimanusharma opened this issue Feb 11, 2021 · 0 comments

Comments

@abhimanusharma
Copy link

I have html design of vue material multi select, where I want the multi select options to close on click of a button.

Here is my design
multiselect

I tried this:
this.$refs.selectAgent.$el.children[0].click();
this.$refs.selectAgent.$el.children[0].focus();
this.$refs.selectAgent.$el.children[0].blur();

<md-field>
    <label for="agents">Select user</label>
    <md-select v-model="selectedAgents" name="agents" id="agents" ref="selectAgent" multiple>
        <div class="add-user-outer">
            <div class="add-user-searchbox d-flex align-center">
                <md-icon class="brand-primary search">search</md-icon>
                <md-field md-inline>
                    <label>Search By Name</label>
                    <md-input v-model="agentSearchQuery"></md-input>
                </md-field>
                <md-button :md-ripple="false" class="md-primary" @click="selectAgents">
                    <md-icon>add</md-icon>
                    Add User
                </md-button>
            </div>
        </div>

        <md-option v-for="agent in resultAgents" :key="agent.id" :value="agent.id" class="share-dropdown">
            <md-avatar class="mr-2">
                <div v-if="!agent.image" class="md-avatar position-absolute md-intial">
                {{ agent.first_name.substring(0, 1).toUpperCase()
                }}{{ agent.last_name.substring(0, 1).toUpperCase() }}
                </div>
                <img v-else :src="`/images/users/`+agent.image" alt="Avatar" class="avatar-sidebar"/>
            </md-avatar>
            <div class="text-content">
                <h4 class="text-primary">{{agent.first_name}} {{agent.last_name}}</h4>
                <p class="description-normal text-description text-left font-weight-regular">
                    {{agent.email}}
                </p>
            </div>
        </md-option>
    </md-select>
</md-field>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant