-
Notifications
You must be signed in to change notification settings - Fork 58
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
Migrate DoubleRow and TableMenu components from maas-ui #380
Comments
@huwshimi you mentioned there needs to be a discussion on cell generation before this can happen. Would it be possible for you to put forward a proposal of how you think it would work? |
Sure, I'll take a look and reply here with the details. |
Initially I thought we'd have to generate the row objects, but I think instead we should:
I have branch that implements about half of this which I can keep tinkering with when I have some time. |
@huwshimi Thanks for the summary. I don't know the exact context of the double row in maas-ui, but from the things that you mention it seems like there is a lot about icons, and not much about double rows. :) Could you throw some screenshots into this issue to show what kind of content/icons need to be implemented in modular table? This will also let me better understand the needs so I can try to help suggest how to implement in in ReactTable (at least as much as I remember their API). |
@bartaz here's how they look in MAAS. We also sometimes have checkboxes in the icon slot (and then sometimes have nested checkboxes like in this screenshot). |
Thanks. It seems to me that the checkbox is not an icon, it's a selectable row which is a separate and different feature that would need to be ported to modular table: https://discourse.ubuntu.com/t/row-selection/19847 From implementation point of view ReactTable has a hook for row selection, hopefully we should be able to use it as is: https://react-table.tanstack.com/docs/examples/row-selection As for the 'nested' rows, it seems that this is MAAS way of doing grouping of the table rows. And as far as I understand the modular table is not going to do the grouping by nesting, it's supposed to be more like RBAC style: https://discourse.ubuntu.com/t/grouping/19857 ReactTable has a support for grouping (https://react-table.tanstack.com/docs/examples/grouping) by the value of a column (which seems to be what we need), so maybe we could use that. Although their example looks a bit different from our spec (they have a 'grouping' row that can be expanded/collapsed), but hopefully we could use their grouping hook implementation for data manipulation, but still render it as we need. |
As for the double row implementation, ReactTable allows a lot of customisation about how cells are rendered. By default the column options (https://react-table.tanstack.com/docs/api/useTable#column-options) have So I think the easiest way to implement double rows would be to implement custom
But also maybe we can be more smart and not hardcode the data fields, but pass some configuration via custom column props or something... |
I just pushed up my branch from a while ago where I started this work: It looks like it contains some custom CSS, but it seems we no longer include CSS in react-components so I guess we need to upstream the double row and table menu styles first: |
This should be made to work with ModularTable.
The text was updated successfully, but these errors were encountered: