New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nextProps.data.slice is not a function #605
Comments
@cj285,
How to avoid? You need implement Thanks |
Hi, I'm wondering if I explained myself properly because this seems like a bug more than a feature. The case I'm tallking about is like the following. Let's say my component that contains the react-bootstrap-table has the following state:
Now, I pass A to BootstrapTable by doing
On the first rendering, this is fine. But let's say I modified A to A'. This is where the error message occurs. At this point, data is filled with
rather than just A. (data={this.state}) Similarly if I change B. I apologize if I didn't understand your explanation. Thank you very much for the help! |
how did you modify? and I really dont understand what you said. |
this.store.setData(nextProps.data.slice()); // giving error unable to select the row
|
@tkssharma, the |
@AllenFang can you provide an example of it.. I cannot display the data obtained from an API |
Hi Allen , how to wrap react-bootstrap-table inside componentWillReceiveProps ?
,and in render method i have my bootstrap table whose data i am setting from state , i am still getting the same original posted error "TypeError: nextProps.data.slice is not a function BootstrapTable.componentWillReceiveProps" Will appreciate your help on this . |
Hi! I am trying to integrate socket.io with your table. When I do so, I run into the following:
this.store.setData(nextProps.data.slice());
This seems to happen when I try to set the Parent state which will be passed into the table rows. This does not happen on the initial render, and only on rerenders. Thanks for your hard work with this table! It's been great.
Update: On further inspection, it seems that my whole Parent state is flowing into the BootstrapTable even though I only ever sent this.state.data to the table.
Second Update: I managed to fix this using a quick hack to check if the data was actually an array or not. However, this doesn't fix the underlying bug. Could someone explain why the whole state seemsto be passed to the table through data?
The text was updated successfully, but these errors were encountered: