-
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
[ModularTable] Add prop for plugin passthrough #440
Comments
To make this truly functional we would also have to take an const instance = useTable.call(this, [{
data,
columns,
...configOptions
}, ...extensionHooks]); I had first explored the idea of having boolean values to enable/disable the hooks that we want to support but I figured keeping the options and plugin hooks open allowed for a lot more flexibility. |
Thanks Jeff, it's an interesting idea. As far as I remember I did initially intend to expose the internals of ModularTable more. One reasons I haven't done that is that it seems to allow and encourage building custom solutions in products rather than implementing the consistent behaviour as intended by modular table design. I'm afraid that by allowing to pass hooks into ModularTable, product teams will rather use that when needed (for example for grouping) rather than contribute to 'official' grouping in the ModularTable component. The other thing is - what to do with custom props that may override the built-ins? Currently we don't use any plugins internally in ModularTable, but once we start it's a valid risk. If we allow to override the plugins and options it may lead to unexpected behaviours or errors. I'm keen on the idea of flexibility, I just don't know how to make it work well with consistent built-in functionality. |
I also share Bartek's concern regarding custom implementations. In practise, we have less than 10 tables build with React across the team. So we should be able to build each one from built in functionally. @hatched which part of the design attached requires an extension? |
After discussing this with @huwshimi and @Caleb-Ellis we've come to a different proposal that I think works quite well. Instead of enabling or disabling plugins and supplying configuration values as separate props we will use a more data driven approach and enable or disable features based on the dataset passed in. In the original case, if you pass a dataset with For the second case in this following image we need to be able to expand or collapse the rows depending on an out-of-table UI element. To accomplish this we can add a new prop that's simply As for additional plugins. I expect that we'll need to continuously add new features as time goes on but by going with a data driven approach and then adding simple props for the more advanced functionalities should allow us to keep the API surface area to a minimum. 🤞 |
@hatch That sounds good. Thanks for the update. Having quickly a look at |
React Table
useTable
takesn
arguments after the first for plugins.In order to implement the grouping in the Juju Dashboards Action Logs UI it looks like using
useExpanded
with the default be expanded might be the best way to implement this functionality. To this end I'd like to expand ModularTable to take aplugins
prop to be expanded out when callinguseTable
.The text was updated successfully, but these errors were encountered: