@@ -18,7 +18,6 @@ class BootstrapTable extends Component {
1818 constructor ( props ) {
1919 super ( props ) ;
2020 this . isIE = false ;
21- this . _attachCellEditFunc ( ) ;
2221 if ( Util . canUseDOM ( ) ) {
2322 this . isIE = document . documentMode ;
2423 }
@@ -326,22 +325,11 @@ class BootstrapTable extends Component {
326325
327326 componentDidUpdate ( ) {
328327 this . _adjustTable ( ) ;
329- this . _attachCellEditFunc ( ) ;
330328 if ( this . props . options . afterTableComplete ) {
331329 this . props . options . afterTableComplete ( ) ;
332330 }
333331 }
334332
335- _attachCellEditFunc ( ) {
336- const { cellEdit } = this . props ;
337- if ( cellEdit ) {
338- this . props . cellEdit . __onCompleteEdit__ = this . handleEditCell . bind ( this ) ;
339- if ( cellEdit . mode !== Const . CELL_EDIT_NONE ) {
340- this . props . selectRow . clickToSelect = false ;
341- }
342- }
343- }
344-
345333 /**
346334 * Returns true if in the current configuration,
347335 * the datagrid should load its data remotely.
@@ -394,6 +382,10 @@ class BootstrapTable extends Component {
394382 const { paginationPosition = Const . PAGINATION_POS_BOTTOM } = this . props . options ;
395383 const showPaginationOnTop = paginationPosition !== Const . PAGINATION_POS_BOTTOM ;
396384 const showPaginationOnBottom = paginationPosition !== Const . PAGINATION_POS_TOP ;
385+ const selectRow = { ...this . props . selectRow } ;
386+ if ( this . props . cellEdit && this . props . cellEdit . mode !== Const . CELL_EDIT_NONE ) {
387+ selectRow . clickToSelect = false ;
388+ }
397389
398390 return (
399391 < div className = { classSet ( 'react-bs-table-container' , this . props . className , this . props . containerClass ) }
@@ -447,7 +439,7 @@ class BootstrapTable extends Component {
447439 hover = { this . props . hover }
448440 keyField = { this . store . getKeyField ( ) }
449441 condensed = { this . props . condensed }
450- selectRow = { this . props . selectRow }
442+ selectRow = { selectRow }
451443 expandColumnOptions = { this . props . expandColumnOptions }
452444 cellEdit = { this . props . cellEdit }
453445 selectedRowKeys = { this . state . selectedRowKeys }
@@ -466,7 +458,8 @@ class BootstrapTable extends Component {
466458 onNavigateCell = { this . handleNavigateCell }
467459 x = { this . state . x }
468460 y = { this . state . y }
469- withoutTabIndex = { this . props . withoutTabIndex } />
461+ withoutTabIndex = { this . props . withoutTabIndex }
462+ onEditCell = { this . handleEditCell } />
470463 </ div >
471464 { tableFilter }
472465 { showPaginationOnBottom ? pagination : null }
@@ -793,7 +786,7 @@ class BootstrapTable extends Component {
793786 }
794787 }
795788
796- handleEditCell ( newVal , rowIndex , colIndex ) {
789+ handleEditCell = ( newVal , rowIndex , colIndex ) => {
797790 const { beforeSaveCell } = this . props . cellEdit ;
798791 const columns = this . getColumnsDescription ( this . props ) ;
799792 const fieldName = columns [ colIndex ] . name ;
0 commit comments