Added render format to 'Duration' table column

This commit is contained in:
KharchenkoVV 2021-08-30 16:17:58 +05:00
parent fb8d693a15
commit 81c457c350

View File

@ -23,6 +23,10 @@ const numericSortColumnOptions = Object.assign({
sorter: makeNumericSorter('wellDepth') sorter: makeNumericSorter('wellDepth')
}, numericColumnOptions) }, numericColumnOptions)
const durationFormattedColumnOptions = Object.assign({
render:(value) => Number.isNaN(value.toFixed(2)) ? "-" : value.toFixed(2)
}, numericColumnOptions)
export const WellOperationsEditor = ({idWell, idType}) => { export const WellOperationsEditor = ({idWell, idType}) => {
const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize}) const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize})
@ -79,7 +83,7 @@ export const WellOperationsEditor = ({idWell, idType}) => {
sorter: makeDateSorter('startDate'), sorter: makeDateSorter('startDate'),
render:(_, record) => moment.utc(record.startDate).local().format(format) render:(_, record) => moment.utc(record.startDate).local().format(format)
}), }),
makeColumn('Часы','durationHours', numericColumnOptions), makeColumn('Часы','durationHours', durationFormattedColumnOptions),
makeColumn('Комментарий','comment', {editable:true, input:<TextArea/>}), makeColumn('Комментарий','comment', {editable:true, input:<TextArea/>}),
] ]