首页 > 解决方案 > Exception has occurred: TypeError: Cannot assign to read only property with ag-grid-community cellEditor: 'numericEditor'

问题描述

I am using the example from the Ag-Grid Documentation in a SPFx web part. I managed to use "NumericEditor" from the example (only had to change props to props:any because of typescript ) I do get the input box to show in the grid enter image description here

But when leave the cell, I get an error in the console and app stopps

Exception has occurred: TypeError: Cannot assign to read only property 'pages' of object '#<Object>'
  at ValueService../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.ValueService.setValueUsingField (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:101927:25)
    at ValueService../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.ValueService.setValue (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:101878:38)
    at RowNode../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.RowNode.setDataValue (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:87664:33)
    at CellCtrl../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.CellCtrl.saveNewValue (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:93946:26)
    at CellCtrl../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.CellCtrl.stopEditing (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:93958:18)
    at CellCtrl../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.CellCtrl.stopRowOrCellEdit (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:93908:18)
    at CellCtrl../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.CellCtrl.onCellFocused (https://localhost:4321/dist/ace-multi-steps-request-web-part.js:94435:18)

The property 'pages' is part of the item in an array of the state used for rowData of the AgGridReact

Can anyone explain this or help? Thanks

I tried also Hook Cell Editor But TypeScript complains on "props.value" until I change to props:any. Also in never finishes the edit like in the sample (the inputbox is visible)

Help :-)

标签: ag-gridag-grid-reactspfx

解决方案


推荐阅读