react-bootstrap-table2 icon indicating copy to clipboard operation
react-bootstrap-table2 copied to clipboard

TypeError: dataOperator.typeConvert is not a function

Open FADIcheikh opened this issue 4 years ago • 2 comments

When i'm trying to edit cells i'm getting the following error 'TypeError: dataOperator.typeConvert is not a function' I went throught a basic installation (npm install react-bootstrap-table2-editor --save) and it downloaded 1.4.0 version I tried to debug and i found out that in context.js dataOperator does not have typeConvert method and if i comment this line

line 81: var newValueWithType = dataOperator.typeConvert(column.type, newValue);

and replace all occurences of newValueWithType with newValue it will work as intended and I'm aware that this not safe (beacuse of the column type) In the same time I'm not allowed to do this on production mode Any help would be appreciated.

here is the code i used:

import BootstrapTable from "react-bootstrap-table-next";
import cellEditFactory from 'react-bootstrap-table2-editor';

const cellEdit = cellEditFactory({
  mode: 'click',
  beforeSaveCell(oldValue, newValue, row, column, done) {console.log(row)},
  afterSaveCell: (oldValue, newValue, row, column) => { console.log(row)}
});

columns={[
                  {
                    dataField: "xx",
                    text: "xx",
                    sort: true,
                    editable: false
                  },
                  {
                    dataField: "yy",
                    text: "yy",
                    sort: true,
                    type: 'string',
                    editable: true
                  },
                  {
                    dataField: "zz",
                    text: "zz",
                    sort: true,
                    editable: false
                  },
            ]}

 <BootstrapTable   cellEdit={ cellEdit }  />

FADIcheikh avatar Jul 31 '21 09:07 FADIcheikh

I'm having the same issue. did you have any luck?

BowenMichael avatar Jun 29 '22 19:06 BowenMichael

Still getting this error too. 1.4.0. I set a breakpoint and its undefined.

sinclas avatar Dec 22 '22 18:12 sinclas