Skip to content

Commit

Permalink
Merge pull request #1375 from bcgov/fix/daniel-data-fixes-1321
Browse files Browse the repository at this point in the history
fix: Set kWH to number editor and number formatter
  • Loading branch information
dhaselhan authored Dec 5, 2024
2 parents 3f072d0 + 22d4736 commit a1aa138
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions frontend/src/views/FinalSupplyEquipments/_schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ import {
RequiredHeader,
DateRangeCellEditor,
TextCellEditor,
AsyncSuggestionEditor
AsyncSuggestionEditor,
NumberEditor
} from '@/components/BCDataGrid/components'
import i18n from '@/i18n'
import { actions, validation } from '@/components/BCDataGrid/columns'
import moment from 'moment'
import { CommonArrayRenderer } from '@/utils/grid/cellRenderers'
import { StandardCellErrors } from '@/utils/grid/errorRenderers'
import { apiRoutes } from '@/constants/routes'
import { numberFormatter } from '@/utils/formatters.js'

export const finalSupplyEquipmentColDefs = (optionsData, compliancePeriod, errors) => [
export const finalSupplyEquipmentColDefs = (
optionsData,
compliancePeriod,
errors
) => [
validation,
actions({
enableDuplicate: true,
Expand Down Expand Up @@ -76,13 +82,15 @@ export const finalSupplyEquipmentColDefs = (optionsData, compliancePeriod, error
'finalSupplyEquipment:finalSupplyEquipmentColLabels.kwhUsage'
),
minWidth: 220,
cellEditor: 'agTextCellEditor',
cellDataType: 'text',
cellStyle: (params) => StandardCellErrors(params, errors),
valueFormatter: (params) => {
const value = parseFloat(params.value)
return !isNaN(value) ? value.toFixed(2) : ''
}
valueFormatter: numberFormatter,
cellEditor: NumberEditor,
type: 'numericColumn',
cellEditorParams: {
precision: 0,
min: 0,
showStepperButtons: false
},
cellStyle: (params) => StandardCellErrors(params, errors)
},
{
field: 'serialNbr',
Expand Down

0 comments on commit a1aa138

Please sign in to comment.