File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ const _editModeSetter = (params) => {
12
12
return true ;
13
13
} ;
14
14
15
+ const _stringSetter = ( params ) => {
16
+ let newValue = params . newValue ?. trim ( ) ?? '' ;
17
+ const unauthorizedEmptyField = newValue . length === 0 && ! params . colDef . cellEditorParams ?. acceptsEmptyFields ;
18
+
19
+ if ( ! params . context . editMode || unauthorizedEmptyField ) {
20
+ newValue = params . oldValue ;
21
+ }
22
+
23
+ params . data [ params . colDef . field ] = newValue ;
24
+ return true ;
25
+ } ;
26
+
15
27
const _boolSetter = ( params ) => {
16
28
let newValue = params . newValue ?. toLowerCase ( ) ?? '' ;
17
29
const allowedEmptyField = params . colDef . cellEditorParams ?. acceptsEmptyFields && newValue . length === 0 ;
@@ -160,7 +172,7 @@ export const getColumnTypes = (dateFormat) => {
160
172
nonEditable : { editable : false } ,
161
173
nonResizable : { resizable : false } ,
162
174
nonSortable : { sortable : false } ,
163
- string : { } , // No specific behavior here, but required to prevent ag-grid warning
175
+ string : { valueSetter : _stringSetter } ,
164
176
bool : {
165
177
valueSetter : _boolSetter ,
166
178
} ,
You can’t perform that action at this time.
0 commit comments