Browse Source

fix: switching checkbox to multiselect - mysql

re #6747
pull/7054/head
Pranav C 11 months ago
parent
commit
efb539a4e6
  1. 13
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 4
      packages/nc-gui/components/smartsheet/column/SelectOptions.vue
  3. 2
      packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts

13
packages/nc-gui/components/cell/MultiSelect.vue

@ -132,9 +132,13 @@ const vModel = computed({
const selectedTitles = computed(() =>
modelValue
? typeof modelValue === 'string'
? isMysql(column.value.source_id)
? modelValue.split(',').sort((a, b) => {
? Array.isArray(modelValue)
? modelValue
: isMysql(column.value.source_id)
? modelValue
.toString()
.split(',')
.sort((a, b) => {
const opa = options.value.find((el) => el.title === a)
const opb = options.value.find((el) => el.title === b)
if (opa && opb) {
@ -142,8 +146,7 @@ const selectedTitles = computed(() =>
}
return 0
})
: modelValue.split(',')
: modelValue
: modelValue.toString().split(',')
: [],
)

4
packages/nc-gui/components/smartsheet/column/SelectOptions.vue

@ -113,7 +113,7 @@ onMounted(() => {
op.title = op.title.replace(/^'/, '').replace(/'$/, '')
}
if (vModel.value.cdf) {
if (vModel.value.cdf && typeof vModel.value.cdf === 'string') {
const fndDefaultOption = options.value.find((el) => el.title === vModel.value.cdf)
if (!fndDefaultOption) {
vModel.value.cdf = vModel.value.cdf.replace(/^'/, '').replace(/'$/, '')
@ -249,7 +249,7 @@ const undoRemoveRenderedOption = (index: number) => {
// Removes the Select Option from cdf if the option is removed
watch(vModel.value, (next) => {
const cdfs = (next.cdf ?? '').split(',')
const cdfs = (next.cdf ?? '').toString().split(',')
const values = (next.colOptions.options ?? []).map((col) => {
return col.title.replace(/^'/, '').replace(/'$/, '')
})

2
packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts

@ -987,7 +987,7 @@ export class MysqlUi {
colProp.dt = 'set';
if (
col.colOptions?.options.length > 64 ||
col.dtxp?.split(',').length > 64
col.dtxp?.toString?.()?.split(',').length > 64
) {
colProp.dt = 'text';
}

Loading…
Cancel
Save