Skip to content
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

Cannot assign to read only property 'children' of object '#<Object>' #424

Closed
sgentile opened this issue Apr 27, 2016 · 6 comments
Closed
Labels

Comments

@sgentile
Copy link

I'm getting the following error just setting up the sample inside my application...

import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
render(){
        var products = [
            {
                id: 1,
                name: "Product1",
                price: 120
            },{
                id: 2,
                name: "Product2",
                price: 80
            },{
                id: 3,
                name: "Product3",
                price: 207
            },{
                id: 4,
                name: "Product4",
                price: 100
            },{
                id: 5,
                name: "Product5",
                price: 150
            },{
                id: 6,
                name: "Product1",
                price: 160
            }
        ];
        return (
            <div className="box box-blue">
                <div className="box-body">

                    <BootstrapTable data={products}>
                        <TableHeaderColumn isKey={true} dataField="id">Product ID</TableHeaderColumn>
                    </BootstrapTable>
...

I am using the latest React so not sure if that is part of the issue ?

@sgentile
Copy link
Author

sgentile commented Apr 27, 2016

More info, the error is that it's attempting to set the readonly prop inside the TableHeader.js

_attachClearSortCaretFunc() {
    ...
      this.props.children =
        React.cloneElement(children,
          { key: 0, onSort, sort, sortIndicator });
    }
  }

@AllenFang
Copy link
Owner

@sgentile, it's a bug, I'll fix it in these day. Thanks :)

@AllenFang AllenFang added the bug label Apr 27, 2016
@sgentile
Copy link
Author

Thank you sir!

@trivektor
Copy link

I encountered this too. It seemed to happen if the table only has 1 column.

@AllenFang
Copy link
Owner

@trivektor, yes!

@AllenFang
Copy link
Owner

hi all, fixes on v2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants