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

Wrapping a reactabular row with an HOC/Context #360

Open
dannyhuly opened this issue Oct 15, 2018 · 4 comments
Open

Wrapping a reactabular row with an HOC/Context #360

dannyhuly opened this issue Oct 15, 2018 · 4 comments

Comments

@dannyhuly
Copy link

dannyhuly commented Oct 15, 2018

Hi,
Is possible to wrap a row with a HOC or Context ?
I would like to implement a table row edit (not cell by cell edit) but i'm unable to use informed or Formik to wrap a reactabular row with a form control logic.

Is there a way to manipulate a row or is the API only allows cell manipulation ?

Any ideas ?
Thanks.

@dannyhuly dannyhuly changed the title Wrapping table a row with an HOC/Context Wrapping a reactabular row with an HOC/Context Oct 15, 2018
@bebraw
Copy link
Member

bebraw commented Oct 17, 2018

Did you notice the components API? Technically you can override anything that's in the structure (the component is headless).

Could you set up a small example of what you have together so far?

@bebraw
Copy link
Member

bebraw commented Oct 21, 2018

Here are the related docs: https://reactabular.js.org/#/table/overriding-default-renderers .

@dannyhuly
Copy link
Author

Its looks like using the Table.Provider renders (specifically the body.row) can help with wrapping the TableRow with a HOC.

const RowWrapper = props => (<tr>...</tr>);
<Table.Provider
  columns={...}
  renderers={{
    body: {
      row: RowWrapper
    }
  }}
>
   ...
<Table.Provider />

The thing is that the RowWrapper only receives children.
If props like property and rowData would pass throughה 'TableRow' then a RowWrapper would have the scope that I need.
The bad thing about passing down extra props will be the additional renders on row rather then only render on cells (From what I understand).

Close, but no cigar (yet).

@bebraw
Copy link
Member

bebraw commented Oct 31, 2018

@dannyhuly I'm working on a small re-design (separate branch) but I haven't gotten around to finishing it yet as I've been too busy with paid work (I do this one for free so it progresses slowly). Likely finishing that might help in this particular case as it makes the library more flexible.

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