abhimediratta / vue-multiselect-listbox Goto Github PK
View Code? Open in Web Editor NEWVue Multi-Select Dual Listbox
Vue Multi-Select Dual Listbox
Is it possible to sort selected values dynamically by user action?
If yes, how/where to modify the existing codes?
Thank you very much
Hi guys, how are you ?
First, thank you for the beautiful component.
I have one doubt, how can I change the width of the component, because in the window is rendered small, and I have so much space, but aparently is not responsive or I dont know how to use.
Thanks.
There is issue here...
With complex objects when user tries to use "reduce-value-property" prop and passes function something like:
(option) => option.id
let valueIndex = items.findIndex((item) => {
if (this.reduceValueProperty) {
return item && option
&& (getValueFromOption(this.reduceValueProperty, item)
=== getValueFromOption(this.reduceValueProperty, option));
}
return item === option;
});
getValueFromOption(this.reduceValueProperty, item) <---- here item is already filtered ID, so you get UNDEFINED as you cant get ID from a string.
getValueFromOption(this.reduceValueProperty, option)) <---- here option is Object so you get back VALUE
Hi
I´m using the component inside a bootstrap modal, this modal appears whenever the user clicks on a button and i call a axios....the thing is, the v-model does not update with the axios response, any idea why?
Regards
Im filling v-model with the same structure array as in options array but i dont get the selected values in right column
Hello author,
thank you for the beautiful component.
I am facing a problem.
that is on v-model its returns the hole object with label and code but I want it just to return the code only.
How I can do that please help me.
Is this compatible with the new composition API?
Would love to use this, Probably doing something wrong, am not too good with vuejs. I am trying to follow the tutorial.
App.vue
<template>
<h2>Example</h2>
<h3>List Options</h3>
<v-multiselect-listbox :options="['Alabama', 'California']"></v-multiselect-listbox>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code">
</v-multiselect-listbox>
<h3>Group List options</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al', group: 'US'}, {label: 'California', code: 'cal', group: 'US'}, {label: 'British Columbia', code: 'bc', group: 'Canada'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
:reduce-group-property="(option) => option.group">
</v-multiselect-listbox>
<h3>Select/Deselect All Buttons</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
:show-select-all-buttons="false">
</v-multiselect-listbox>
<h3>Highlight Difference from the original input</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
search-input-class="custom-input-class"
highlight-diff>
</v-multiselect-listbox>
<h3>Search Input Placeholder</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
search-options-placeholder="Search states"
selected-options-placeholder="Search selected states">
</v-multiselect-listbox>
<h3>Empty Listbox Placeholder</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
no-options-text="No states"
selected-no-options-text="No states selected">
</v-multiselect-listbox>
<h3>Empty Search Placeholder</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
no-options-found-text="No state found"
no-selected-options-found-text="No selected state found">
</v-multiselect-listbox>
<h3>Hide Search Input</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
no-options-found-text="No state found"
no-selected-options-found-text="No selected state found"
hide-search-inputs>
</v-multiselect-listbox>
<h3>Style Search Input</h3>
<v-multiselect-listbox :options="[{label: 'Alabama', code: 'al'}, {label: 'California', code: 'cal'}]"
:reduce-display-property="(option) => option.label"
:reduce-value-property="(option) => option.code"
search-input-class="custom-input-class">
</v-multiselect-listbox>
</template>
<script>
import vMultiselectListbox from 'vue-multiselect-listbox'
import 'vue-multiselect-listbox/dist/vue-multi-select-listbox.css';
export default {
name: 'Paste-test',
components: { 'v-multiselect-listbox': vMultiselectListbox },
data () {
return {
selected: '',
options: ['10001', '10002', '10003', '10004', '10005', '10006', '10007', '10008', '10009', '10010'],
}
},
methods: {
parse_clipboard(content) {
var arr = content.split(/[\s,]+/)
var trimmed = '';
var results = arr.filter(element => {
trimmed = element.trim();
if (trimmed.length) {
return trimmed;
}
});
return results
},
handlePaste(evt) {
var data = evt.clipboardData.getData('text/plain');
console.log('TwoPaneMultiSelect pasted data=', data);
evt.preventDefault();
var parsed_data = this.parse_clipboard(data);
console.log('TwoPaneMultiSelect parsed_data=', parsed_data);
this.options = parsed_data;
this.selected = parsed_data;
}
}
}
</script>
main.js
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
All it renders it this:
And this error in the console:
I am using vuejs3.
Thanks!
I want to hide the input because I don't need the search function
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.