question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data change but table not load it

See original GitHub issue

Code is like this:

<BootstrapTable data={this.props.data}>

when this.props.data change , BootstrapTable does not load it. I think the feature dataSet.setData cause the problem?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
chuchengcaocommented, Aug 13, 2015

Sorry, I didn’t describe the question clearly. Yes, componentDidUpdate will not cause render, but my question is not this.
There is an example code, when you click the ‘change-data’ button, you can see the data change in console log, but the page do not change the data.

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>
        )
    }
}
0reactions
anitaIncaendocommented, Dec 21, 2017

@AllenFang to apply server side pagination, i set data ={this.state.data}. in

_

_> '<BootstrapTable

      remote
      data={this.state.data}
      striped hover pagination
      search multiColumnSearch
      cellEdit={cellEditProp}
      fetchInfo={{ dataTotalSize: 70 }}
      options={options}
    >
      <TableHeaderColumn dataField='_id' isKey hidden>ID</TableHeaderColumn>          
      <TableHeaderColumn dataField='sessionDatetime'  >  Session Time    </TableHeaderColumn>
      <TableHeaderColumn dataField='status' >Status</TableHeaderColumn>
    </BootstrapTable>'__

but on click on page=3 , state is changing correctly but table data is not changing. As initial value of my this.state.data=[]. so in the table, no data display message is showing rather change data of my state

I am using “version”: “4.1.3”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datatable not loading updated table data
I am using the below datatable script version and applying the datatable onto my table with id=qcProcessPageTable as ('#qcProcessPageTable').
Read more >
datatable not loading data on page load - Stack Overflow
when I load page data wont display. If I try to select filter value or search then data will load even for static...
Read more >
Refresh PivotTable data - Microsoft Support
Manually refresh or update data in a PivotTable that's connected to an external data source to see changes that were made to that...
Read more >
Data Tables – How to Set Up and Troubleshoot One of Excel's ...
Attempting to run the Data Table tool when all the cells in the table are not consistent will result in an error. To...
Read more >
Adding a item in mat table, the UI does not refresh - Reddit
this.dataSource.data = data;. UPDATE: It is working on stackblitz, but it does not work on my actual project. GG.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found