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

When search something, data change but table not load it #33

Closed
chuchengcao opened this issue Aug 19, 2015 · 4 comments
Closed

When search something, data change but table not load it #33

chuchengcao opened this issue Aug 19, 2015 · 4 comments

Comments

@chuchengcao
Copy link

Type "sdf" in the search input, click the change-data button, data not change.

class TestPage extends React.Component{
    constructor(){
        super();
        this.state = {dataSet:[
            {"objectName":"sdfsdfsdf33","userId":"cc","perms":["READ","WRITE"],"id":1}
        ]
        }
    }

    render (){
        console.log("this.state.dataSet", this.state.dataSet);
        return (
                    <div className='maxw80 ma'>
                        <BootstrapTable data={this.state.dataSet}
                                        striped={true} hover={true} condensed={false} search={true} pagination={true}>
                            <TableHeaderColumn className='clgrey' dataField="id" isKey={true} dataAlign="center"
                                               dataSort={true}>#</TableHeaderColumn>
                            <TableHeaderColumn dataField="objectName" dataSort={true}>name</TableHeaderColumn>
                            <TableHeaderColumn dataField="userId" dataSort={true}>userName</TableHeaderColumn>
                            <TableHeaderColumn dataField="perms" dataSort={true}
                                               dataFormat={(cell, row)=>(<span>{cell.toString()}</span>)}>
                                auth
                            </TableHeaderColumn>
                            <TableHeaderColumn dataField="id">
                                op
                            </TableHeaderColumn>
                        </BootstrapTable>
                        <button onClick={function(){this.setState({dataSet:[{"objectName":"newdata","userId":"all","perms":["READ"],"id":5}]})}.bind(this)}>change-data</button>
                    </div>
        )
    }
}
@chuchengcao chuchengcao changed the title data change but table not load it data change but table not load it when search something Aug 19, 2015
@chuchengcao chuchengcao changed the title data change but table not load it when search something when search something data change but table not load it Aug 19, 2015
@chuchengcao chuchengcao changed the title when search something data change but table not load it When search something, data change but table not load it Aug 19, 2015
@AllenFang
Copy link
Owner

hello @chuchengcao, I've fix this problem on v0.9.9 :)

@chuchengcao
Copy link
Author

hello @AllenFang , v0.9.9 still has some problem. The data updated but the result is not filtered by the search string. Look for this example, type 'sdf' -> change-data -> expect the table shows result which only contain 'sdf' string according to the search, but the table shows all table data.

class TestPage extends React.Component{
    constructor(){
        super();
        this.state = {dataSet:[
            {"objectName":"sdfsdfsdf33","userId":"cc","perms":["READ","WRITE"],"id":1},
            {"objectName":"3333","userId":"cc","perms":["READ","WRITE"],"id":2},
            {"objectName":"4444sdf","userId":"cc","perms":["READ","WRITE"],"id":3}
        ]
        }
    }

    _onChange(){
        this.setState({dataSet:[
            {"objectName":"newdata","userId":"all","perms":["READ"],"id":1},
            {"objectName":"3333","userId":"cc","perms":["READ","WRITE"],"id":2},
            {"objectName":"4444sdf","userId":"cc","perms":["READ","WRITE"],"id":3}]
        })
    }

    render (){
        console.log("this.state.dataSet", this.state.dataSet);
        return (
            <div className='maxw80 ma'>
                <BootstrapTable data={this.state.dataSet}
                                striped={true} hover={true} condensed={false} search={true} pagination={true}>
                    <TableHeaderColumn className='clgrey' dataField="id" isKey={true} dataAlign="center"
                                       dataSort={true}>#</TableHeaderColumn>
                    <TableHeaderColumn dataField="objectName" dataSort={true}>name</TableHeaderColumn>
                    <TableHeaderColumn dataField="userId" dataSort={true}>userName</TableHeaderColumn>
                    <TableHeaderColumn dataField="perms" dataSort={true}
                                       dataFormat={(cell, row)=>(<span>{cell.toString()}</span>)}>
                        auth
                    </TableHeaderColumn>
                    <TableHeaderColumn dataField="id">
                        op
                    </TableHeaderColumn>
                </BootstrapTable>
                <button onClick={this._onChange.bind(this)}>change-data</button>
            </div>
        )
    }
}

@AllenFang
Copy link
Owner

Hi @chuchengcao , sorry for later response. I've fix this problem in v0.9.10. :)

@chuchengcao
Copy link
Author

Thank you. v0.9.10 fixed the problem, :)

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

No branches or pull requests

2 participants