From 81c457c35022ccb70ae06399280a9f968e8a7652 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Mon, 30 Aug 2021 16:17:58 +0500 Subject: [PATCH] Added render format to 'Duration' table column --- src/pages/WellOperations/WellOperationsEditor.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/WellOperations/WellOperationsEditor.jsx b/src/pages/WellOperations/WellOperationsEditor.jsx index a49b653..8d9a48e 100644 --- a/src/pages/WellOperations/WellOperationsEditor.jsx +++ b/src/pages/WellOperations/WellOperationsEditor.jsx @@ -23,6 +23,10 @@ const numericSortColumnOptions = Object.assign({ sorter: makeNumericSorter('wellDepth') }, numericColumnOptions) +const durationFormattedColumnOptions = Object.assign({ + render:(value) => Number.isNaN(value.toFixed(2)) ? "-" : value.toFixed(2) +}, numericColumnOptions) + export const WellOperationsEditor = ({idWell, idType}) => { const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize}) @@ -79,7 +83,7 @@ export const WellOperationsEditor = ({idWell, idType}) => { sorter: makeDateSorter('startDate'), render:(_, record) => moment.utc(record.startDate).local().format(format) }), - makeColumn('Часы','durationHours', numericColumnOptions), + makeColumn('Часы','durationHours', durationFormattedColumnOptions), makeColumn('Комментарий','comment', {editable:true, input: