@@ -479,11 +479,11 @@ function getNarrowedColType(type?: string): GridColType | undefined {
479
479
return ( type && type in DEFAULT_COLUMN_TYPES ? type : undefined ) as GridColType | undefined ;
480
480
}
481
481
482
- export function parseColumns ( columns : SerializableGridColumns , isEditable ?: boolean ) : GridColDef [ ] {
482
+ export function parseColumns ( columns : SerializableGridColumns ) : GridColDef [ ] {
483
483
return columns . map ( ( { type : colType , ...column } ) => {
484
484
const isIdColumn = column . field === 'id' ;
485
485
486
- let baseColumn : Omit < GridColDef , 'field' > = { editable : isEditable } ;
486
+ let baseColumn : Omit < GridColDef , 'field' > = { } ;
487
487
488
488
if ( isIdColumn ) {
489
489
baseColumn = {
@@ -1244,8 +1244,8 @@ const DataGridComponent = React.forwardRef(function DataGridComponent(
1244
1244
) ;
1245
1245
1246
1246
const columns : GridColDef [ ] = React . useMemo (
1247
- ( ) => ( columnsProp ? parseColumns ( columnsProp , isRowUpdateModelAvailable ) : [ ] ) ,
1248
- [ columnsProp , isRowUpdateModelAvailable ] ,
1247
+ ( ) => ( columnsProp ? parseColumns ( columnsProp ) : [ ] ) ,
1248
+ [ columnsProp ] ,
1249
1249
) ;
1250
1250
1251
1251
React . useEffect ( ( ) => {
@@ -1270,7 +1270,17 @@ const DataGridComponent = React.forwardRef(function DataGridComponent(
1270
1270
} , [ nodeRuntime , rows ] ) ;
1271
1271
1272
1272
const renderedColumns = React . useMemo < GridColDef [ ] > ( ( ) => {
1273
- const result = [ ...columns ] ;
1273
+ const mapEditableToColumns = columns . map ( ( column ) => {
1274
+ if ( column . editable || column . editable === false ) {
1275
+ return column ;
1276
+ }
1277
+
1278
+ column . editable = isRowUpdateModelAvailable ;
1279
+
1280
+ return column ;
1281
+ } ) ;
1282
+
1283
+ const result = [ ...mapEditableToColumns ] ;
1274
1284
1275
1285
if ( getProviderActions ) {
1276
1286
result . push ( {
@@ -1284,7 +1294,7 @@ const DataGridComponent = React.forwardRef(function DataGridComponent(
1284
1294
}
1285
1295
1286
1296
return result ;
1287
- } , [ columns , getProviderActions ] ) ;
1297
+ } , [ columns , getProviderActions , isRowUpdateModelAvailable ] ) ;
1288
1298
1289
1299
const appHost = useAppHost ( ) ;
1290
1300
const isProPlan = appHost . plan === 'pro' ;
0 commit comments