Inform the user that parent column combobox must be chosen first

This commit is contained in:
Erki Aas 2022-11-15 18:26:16 +02:00
parent 63d8c76c23
commit 79db9a63eb
3 changed files with 25 additions and 4 deletions

View File

@ -24,4 +24,8 @@ div#app {
.vc-container {
font-family: 'Roboto' !important;
}
:root {
--vs-font-size: 1em!important;
}

View File

@ -2,6 +2,7 @@
<v-select
v-model="filterValue"
:options="options"
:placeholder="placeholder"
@open="updateOptions"
></v-select>
</template>
@ -20,7 +21,9 @@ export default {
changeValue: {
},
filter: {
}
},
placeholder: {
},
},
data() {
return {

View File

@ -7,9 +7,10 @@ export default {
Combobox
},
template: `<Combobox
:field="params.field"
:filter="filter"
:change-value="updateFilter"
:field="params.field"
:filter="filter"
:change-value="updateFilter"
:placeholder="placeholder"
/>`,
mounted() {
this.params.api.sizeColumnsToFit()
@ -19,6 +20,19 @@ export default {
filter: '',
};
},
computed: {
placeholder() {
let parentColumnName = this.params.column.userProvidedColDef.filterParams.parentColumn
if (parentColumnName) {
let filterInstance = this.params.api.getFilterInstance(parentColumnName)
if (!filterInstance.filter || filterInstance.filter === '') {
let displayName = filterInstance.params.column.userProvidedColDef.headerName
return `Please select ${displayName} first`
}
}
return ''
}
},
methods: {
updateFilter(value) {
this.filter = value