0

I have quite compicated table in react-bootstrap-table-next wrapped in tookit provider. And I need to add onTableChange function. But console.log writes alaways undefined (checking, order by..)

I am missing something?

onTableChange(type, newState) {
    console.log(type);
    console.log(newState);
  }

   <ToolkitProvider
                    keyField="_id"
                    data={
                        this.state.data
                    }
                    columnToggle
                    columns={
                        this.state.columns
                    }

                    noDataIndication={() => <NoDataIndication />}>
                   <CustomToggleList {...props.columnToggleProps} />
                                <BootstrapTable {...props.baseProps}
                                    pagination={
                                        paginationFactory(options)
                                    }
                                    bordered={false}
                                    bootstrap4
                                    selectRow={selectRowProp}
                                    hover
                                    printable
                                    expandRow={this.props.id !== "LAST LOGIN EVENTS" ?
                                        expandRow : ""
                                    }
                                    onTableChange={this.onTableChange()}
                                    cellEdit={cellEditFactory({
                                        mode: 'click',
                                        blurToSave: true
                                    })}
 />

1 Answer 1

2

Change this:

onTableChange={this.onTableChange()}

To this:

onTableChange={this.onTableChange}

Here this.onTableChange() you're calling the function without params so is undefined.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.