GuillaumeJasmin / react-table-sticky

Sticky hook for react-table v7
MIT License
189 stars 21 forks source link

Cannot read property 'sticky' of undefined when using depth more than 1 #12

Closed hardikmodha closed 4 years ago

hardikmodha commented 4 years ago

react-table-sticky fails with an error

Cannot read property 'sticky' of undefined

when using headergroups with depth having more than 1.

{
  "id": "name_details_container",
  "Header": "Name Details",
  "sticky": "left",
  "Footer": "Name Details",
  "columns": [
    {
      "Header": "Name",
      "Footer": "Name",
      "columns": [
        {
          "Header": "First Name",
          "Footer": "First Name",
          "accessor": "firstName"
        },
        { 
          "Header": "Last Name", 
      "Footer": "Last Name", 
          "accessor": "lastName" 
        }
      ]
    }
  ]
}

Following is a reproducible example:

https://codesandbox.io/s/react-table-sticky-official-r4hjg?file=/src/App.js