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.

Add onTableChange callback on table initialization

See original GitHub issue

Expected Behavior

I’m using a custom toolbar and using onTableChange to track the table state.

I have that state as soon as the user performs a sort or filter operation, but not before then. Adding a call to onTableChange on initialization will provide the client with the internal state to handle any custom actions on an unmodified table.

It is reasonable imo to fire the onTableChange callback on initialization as the table state has in fact changed from uninitialized to initialized.

I created a pull request with my fix but some tests are not passing. If this is something the owners believe fits with the library I will be more than happy to work with them to fix the tests.

My change is a one-liner to add a callback to the call to setTableData to call setTableAction after setState completes. setTableAction results in onTableChange being fired and the client receiving the initialized table state.

initializeTable(props) {
    this.getDefaultOptions(props);
    this.setTableOptions(props);
    this.setTableData(props, TABLE_LOAD.INITIAL, () => {
      this.setTableAction('tableLoadInitial');
    });
  }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shawnmitchellcommented, May 14, 2019

Thanks @gabrielliwerant. I’m a bit swamped today but I will look at this and come up with a pull request for onTableInit - just for the initial mounting - and add the onTableChange callback for updated props. That’s what you have in mind, yeah?

0reactions
gabrielliwerantcommented, May 30, 2019

This feature is now a part of version 2.3.0 thanks to @shawndibble!

Read more comments on GitHub >

github_iconTop Results From Across the Web

add/change callback after initialization, or else clone settings ...
Hi, I'm working with a framework that initializes a table with its own set of parameters which I don't have access to change....
Read more >
Mui-Datatables tableState in function causes infinite loop
You can specify the change action you want to update the table state based on it to avoid the infinite loop onTableChange: (action ......
Read more >
Events - Bootstrap Table
The Events API of Bootstrap Table. Events can be bound in two ways: via the option object; via jquery event handler. Binding via...
Read more >
BootstrapTable Props · react-bootstrap-table2 - GitHub Pages
Note: when remote is enable, you are suppose to give onTableChange prop on ... Same as bootstrap .table-striped class for adding zebra-stripes to...
Read more >
Index (Java Driver for Scylla and Apache Cassandra
Registers separate success and failure callbacks to be run when the Future 's ... Add a clustering column definition to this CREATE TABLE...
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