Browse Source

Merge pull request #7278 from nocodb/fix/decimal-scale

fix: Update dtxs when decimal precision is changing
pull/7285/head
աӄա 8 months ago committed by GitHub
parent
commit
8910befc57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nc-gui/components/smartsheet/column/DecimalOptions.vue

8
packages/nc-gui/components/smartsheet/column/DecimalOptions.vue

@ -30,6 +30,13 @@ onMounted(() => {
vModel.value.meta.precision = precisionFormats[0]
}
})
// update datatype precision when precision is less than the new value
// avoid downgrading precision if the new value is less than the current precision
// to avoid fractional part data loss(eg. 1.2345 -> 1.23)
const onPrecisionChange = (value: number) => {
vModel.value.dtxs = Math.max(value, vModel.value.dtxs)
}
</script>
<template>
@ -38,6 +45,7 @@ onMounted(() => {
v-if="vModel.meta?.precision"
v-model:value="vModel.meta.precision"
dropdown-class-name="nc-dropdown-decimal-format"
@change="onPrecisionChange"
>
<a-select-option v-for="(format, i) of precisionFormats" :key="i" :value="format">
<div class="flex gap-2 w-full justify-between items-center">

Loading…
Cancel
Save