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.

Override internal table state (beta 26)

See original GitHub issue

Describe the bug

Table Options API state.selectedRowPaths: Set<RowPathKey> does not work.

My goal is to provide selection through parent component (making react-table controlled) but internal state override is not taken into account.

To Reproduce

  1. Go to CodeSandBox
  2. Initial state is OK (5th row is selected)
  3. State override is NOK (3th row not selected)

Expected behavior

When provided, Table Options API state should override internal state.

Desktop (please complete the following information):

  • OS : Windows
  • Browser : Chrome
  • Version : 78

Additional context

BETA react-table 26

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12

github_iconTop GitHub Comments

2reactions
tannerlinsleycommented, Dec 5, 2019

This is now available in beta.27

1reaction
afrzcommented, Jan 15, 2020

@serge20 have you tried example given in FAQ ?

Below a constricted sample working in latest version RC15.


//in parent component
 const controlledSelectedRowIds = {
    "id-A": true,
    "id-B": true
  }

//in table definition
useTable({
   useControlledState: state => {
        if (Object.keys(controlledSelectedRowIds).length > 0)
          return { ...state, selectedRowIds: controlledSelectedRowIds };
        return state;
      },
})

In addition, you should use your own select handlers (in your custom table) to maintain selected rows state in your parent component (to update controlledSelectedRowIds in above example) and not use handlers (toggleRowSelected…) provided by the useRowSelect hook.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Override internal table state (beta 26) · Issue #1704 - GitHub
My goal is to provide selection through parent component (making react-table controlled) but internal state override is not taken into ...
Read more >
Change the records with abap in internal table - SAP Community
Hi experts,. In an internal table, i have some data. I want to modify all the records contained in the fieldC to a...
Read more >
Chrome Enterprise and Education release notes
Last updated on: November 29, 2022For administrators who manage Chrome browser or ChromeOS devices for a business or school.
Read more >
Release Notes for Beta Channel - Microsoft Learn
This article contains release notes for Beta Channel builds of Word, Excel, PowerPoint, Outlook, Access, and Project for Windows desktop.
Read more >
Interior Designers : Occupational Outlook Handbook
Interior designers make indoor spaces functional, safe, and beautiful by determining space requirements and selecting essential and ...
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