Comments (9)
I'm vetting table components for work and this is one of our key requirements. I like what you have going, so let me review the source over the weekend to assess the scope.
If you could recommend where to look first, that would help a lot. Thanks.
from table.
from table.
Adding row grouping and aggregation will likely need several additions and edits throughout the entire core. These are some of the requirements/ideas I have in mind out of the gate:
- Row Groups should be infinitely nestable?
- Grouping needs to run pre-sort
- Grouping is achieved using same column mechanics eg. using a string
fieldName
, or callbackd => d.fieldName
- When the bottom level of a grouping is reached, sorting needs to run inside that grouping level (this way sub-items are sorted when exanded), then sorting can work its way up to the parent level of the data using any aggregated data from the group to sort
- Aggregation happens after grouping
- Default and type-aware aggregations
- Utilize built-in aggregations via string or imported const eg.
RowAggregation.avg
- Aggregation callbacks on columns to customize any column
- Pagination should respect sub-rows
- State will need to be manageable both internally and externally (I think the best way to do this is by using reserved keys on the actual rows of data as opposed to mapped metadata). This will probably make it much easier to handle infinitely grouped rows.
- If a row is expanded, its child rows will be inserted after it, at the same dom depth, but with a className to denote its nesting level
- That className should be configurable just like everything else
- When there are any row groups in a table whatsoever, a column will need to be generated at the beginning of each row to control expansion (probably an html arrow out of the box). This column should be completely optional, and should use an internal api that would be available to use in any normal table cell (dogfood that shiz). This way, if someone wants to build their own grouping controls, they can do whatever the heck they want, however they want to do it.
- The grouping model should be transmitted with onChange events. This way: sorting, pagination, and now grouping can all be controlled easily serverside.
- Groupings callbacks will work by returning any unique primitive value (uniqueness will only be detected using a single level equality check, so don't return arrays or objects)
- The grouping model will need to be an array of objects, so it can support names and id's for the groupings. Similarly to sorting, if a grouping uses a custom callback, it will need an ID that it can be sent serverside (since functions cannot).
Thoughts?
from table.
@tannerlinsley Sorry for the delay, been quite busy.
Awesome list, thanks for taking the time to put that together. I think the infinite nesting makes it much more challenging to implement, but its usefulness outweighs that.
The operation order (grouping then sorting) is a good idea, especially for performance on massive lists. Do you imagine the sorting controls on the group or globally on the table head?
Pagination should respect sub-rows.
Not sure I follow what you mean by this. Do you mean that pagination of collapsed groups counts rows and not groups? ie: 3 groups w/ 30 items, 10/page would show a single group per page? I do see the challenge here thought...
State will need to be manageable both internally and externally (I think the best way to do this is by using reserved keys on the actual rows of data as opposed to mapped metadata).
By actual rows do you mean key
or ref
on the components, or are you talking about references to the original objects?
The grouping model should be transmitted with onChange events.
I think this is a great idea. Also, regarding this and the above snippet, should there be a way to disabled or prevent internal state (make it a fully controlled component)?
This and next week I will be diving into working with the library; our initial implementation doesn't require anything fancy, so it'll give me a chance to get a feel for when you already have in place.
I'll circle back early January with more detailed thoughts and feedback.
from table.
This is going to become a higher priority for me very soon. I plan on hopefully having support for this out by the end of February.
I think the best option for now is to assume a like-schema for sub-rows and implement what we have discussed in previous comments to achieve this.
I'll comment again when I begin to work on this if anyone is interested in collaborating on the effort.
:)
from table.
Just released 4.0.0 which was a big overhaul of the display logic and styling. Everything is flexbox now, which should lay a lot of the groundwork for what we're talking about here.
Along with those styling upgrades, a new subComponent
prop allows you to utilize each rows data and return any custom react component of your choosing. You can see it in action here
This is merely a simple proof of concept of how we could implement pivoting and row-grouping in a serious manner. But we also get another win here. Let me explain:
If you're data already contains aggregated rows and drill through data, you can easily pass nested Tables without having to do any aggregation at all. You could even utilize subComponents for charting, large-format meta-data or other types of drill-through.
I'll be working on the actual pivoting and grouping logic in the weeks to come.
from table.
Implemented with 8fa7975! Huzzah!
from table.
Congrats on the release @tannerlinsley, great job on the implementation.
Wish I could have lended a hand; things have just been a little too busy lately 😬
from table.
from table.
Related Issues (20)
- Bug Report: cell.isGrouped Always Returns false Despite enableGrouping Being true (REACT) HOT 2
- The left position of pinned columns in the sticky table is calculated incorrectly HOT 2
- cell only displays one line HOT 1
- When using virtual rendering and column drag-and-drop sorting simultaneously, they don't work well together HOT 3
- onPaginationChange when set to undefined doesn't fallback to using default pagination HOT 1
- Failed to monitor data changes, resulting in page turning without re-rendering. HOT 2
- Table using insane amount of memory even with virtualisation when scrolling HOT 2
- Issue with getIsSomeRowsSelected when using grouping
- [vue table] support for reactivity in Vue-adapter in version 8.20 broke reactive for the old getter `get data()` style HOT 1
- Use of svelte/internal in Svelte 5 HOT 6
- Page sizes that are multiple of 50 don't render new data BUT pagination works HOT 1
- when i useing thead Grouping. only set subHeader enableColumnFilter work, parent Column didn't work HOT 5
- row.getIsSomeSelected() returns true when a sub row is disabled with enableRowSelection
- React Example: Kitchen Sink not loading
- Incomplete Documentation HOT 4
- getIsSomeRowsSelected() does not trigger when all rows are selected
- Weird table sometimes HOT 1
- Improve document context handling in ColumnSizing feature HOT 1
- columnDef.header not being rendered when it's a JSX element HOT 2
- Svelte 5 insert row gives very poor performance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from table.