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

Row Grouping & Aggregation #1

Closed
tannerlinsley opened this issue Oct 24, 2016 · 9 comments
Closed

Row Grouping & Aggregation #1

tannerlinsley opened this issue Oct 24, 2016 · 9 comments

Comments

@tannerlinsley
Copy link
Collaborator

Would love to implement this, and honestly wouldn't be too difficult. Any help here would be appreciated as well. This would be a great intermediate PR for anyone looking to contribute. Let's further discuss some of the requirements of the feature here until we have a solid grasp of the feature.

@lukaswelinder
Copy link

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.

@tannerlinsley
Copy link
Collaborator Author

tannerlinsley commented Dec 8, 2016 via email

@tannerlinsley
Copy link
Collaborator Author

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 callback d => 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?

@lukaswelinder
Copy link

@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.

@tannerlinsley
Copy link
Collaborator Author

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.

:)

@tannerlinsley
Copy link
Collaborator Author

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.

@tannerlinsley
Copy link
Collaborator Author

Implemented with 8fa7975! Huzzah!

@lukaswelinder
Copy link

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 😬

@tannerlinsley
Copy link
Collaborator Author

tannerlinsley commented Jan 20, 2017 via email

gary-menzel added a commit to frankolson/react-table that referenced this issue Nov 23, 2017
KevinVandy pushed a commit that referenced this issue Jan 20, 2025
…Better type safety, allows reactive values into cell content, re-render when cell context changes, allow to pass signal inputs into custom components (#5856)

* feat: flex render granular updates

* updates

* cleanup

* cleanup

* cleanup

* fix test

* angular add explicit version of typescript

* Fix typescript versions

* add some testing for flex render in table

* fix test infra

* refactor flex render

* update lock

* fix tests, cleanup code

* fix tests, cleanup code

* flex render signal content support

* flex render signal content support

* improve view flags, handle state update in zoneless

* improve view flags, handle state update in zoneless

* fix

* ci: apply automated fixes

* clean docs
test
fix doc
add flexRenderComponent util

* test cases

* fix: enable computed rowModels

* fix test for rowModel

* assures that `updateProps` update inputs only for Component reference type

* Merge pull request #1 from riccardoperra/feat/angular-flex-render-support-output-binding

add support for angular outputs in flex-render-component

---------

Co-authored-by: Lachlan Collins <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
KevinVandy added a commit that referenced this issue Feb 10, 2025
* feat(angular-table): Refactor Flex render implementation - Zoneless, Better type safety, allows reactive values into cell content, re-render when cell context changes, allow to pass signal inputs into custom components (#5856)

* feat: flex render granular updates

* updates

* cleanup

* cleanup

* cleanup

* fix test

* angular add explicit version of typescript

* Fix typescript versions

* add some testing for flex render in table

* fix test infra

* refactor flex render

* update lock

* fix tests, cleanup code

* fix tests, cleanup code

* flex render signal content support

* flex render signal content support

* improve view flags, handle state update in zoneless

* improve view flags, handle state update in zoneless

* fix

* ci: apply automated fixes

* clean docs
test
fix doc
add flexRenderComponent util

* test cases

* fix: enable computed rowModels

* fix test for rowModel

* assures that `updateProps` update inputs only for Component reference type

* Merge pull request #1 from riccardoperra/feat/angular-flex-render-support-output-binding

add support for angular outputs in flex-render-component

---------

Co-authored-by: Lachlan Collins <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* release: v8.21.0

* docs(angular): add editable, row-dnd and performant column resizing example (#5881)

* add editable cell example

* add editable cell example

* row dnd exmaple

* revert basic

* ci: apply automated fixes

* column resizing performant example

* fix

* fix budgets

* ci: apply automated fixes

* typo

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* docs(angular): add missing faker-js deps (#5883)

* fix(lit-table): dynamic data updates in the Lit Table Adapter (#5884)

* this fixes an issue I discussed in discord where with the lit table
adapter, updating a data array did not get reflected by the table.

It is a one-line change to the TableController, and a new example that
demonstrates the difference.

* Update packages/lit-table/src/index.ts

per suggestion from @kadoshms

Co-authored-by: Mor Kadosh <[email protected]>

---------

Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Mor Kadosh <[email protected]>

* docs: add experimental virtualization example (#5895)

* docs: add experimental virtualization example

* work on experimental virtualized column examples

---------

Co-authored-by: Kevin Van Cott <[email protected]>

* release: v8.21.1

* docs: example name

* docs(angular): add expanding and sub components examples (#5898)

* docs(angular): add expanding example

* docs(angular): add sub components example

* docs(angular): fix config.json

* fix conflicts in lit package

* remove angular package non-fesm export

* since angular 19, ng-packgr only bundle a `fesm2022` export

* docs: exp virtual - remeasure when table state changes

* docs: virtualizer tbody from onchange

* update all angular examples

* fix conflicts in examples/react

* ci: apply automated fixes

* fix tests

* ci: apply automated fixes

* fix tests

* ci: apply automated fixes

* angular: update vite config to support vitest workspaces

* docs(angular): fix examples

* ci: apply automated fixes

---------

Co-authored-by: Lachlan Collins <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Tanner Linsley <[email protected]>
Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Mor Kadosh <[email protected]>
Co-authored-by: Kevin Van Cott <[email protected]>
Co-authored-by: Kevin Van Cott <[email protected]>
KevinVandy added a commit that referenced this issue Feb 17, 2025
* feat(angular-table): Refactor Flex render implementation - Zoneless, Better type safety, allows reactive values into cell content, re-render when cell context changes, allow to pass signal inputs into custom components (#5856)

* feat: flex render granular updates

* updates

* cleanup

* cleanup

* cleanup

* fix test

* angular add explicit version of typescript

* Fix typescript versions

* add some testing for flex render in table

* fix test infra

* refactor flex render

* update lock

* fix tests, cleanup code

* fix tests, cleanup code

* flex render signal content support

* flex render signal content support

* improve view flags, handle state update in zoneless

* improve view flags, handle state update in zoneless

* fix

* ci: apply automated fixes

* clean docs
test
fix doc
add flexRenderComponent util

* test cases

* fix: enable computed rowModels

* fix test for rowModel

* assures that `updateProps` update inputs only for Component reference type

* Merge pull request #1 from riccardoperra/feat/angular-flex-render-support-output-binding

add support for angular outputs in flex-render-component

---------

Co-authored-by: Lachlan Collins <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* release: v8.21.0

* docs(angular): add editable, row-dnd and performant column resizing example (#5881)

* add editable cell example

* add editable cell example

* row dnd exmaple

* revert basic

* ci: apply automated fixes

* column resizing performant example

* fix

* fix budgets

* ci: apply automated fixes

* typo

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* docs(angular): add missing faker-js deps (#5883)

* fix(lit-table): dynamic data updates in the Lit Table Adapter (#5884)

* this fixes an issue I discussed in discord where with the lit table
adapter, updating a data array did not get reflected by the table.

It is a one-line change to the TableController, and a new example that
demonstrates the difference.

* Update packages/lit-table/src/index.ts

per suggestion from @kadoshms

Co-authored-by: Mor Kadosh <[email protected]>

---------

Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Mor Kadosh <[email protected]>

* docs: add experimental virtualization example (#5895)

* docs: add experimental virtualization example

* work on experimental virtualized column examples

---------

Co-authored-by: Kevin Van Cott <[email protected]>

* release: v8.21.1

* docs: example name

* docs(angular): add expanding and sub components examples (#5898)

* docs(angular): add expanding example

* docs(angular): add sub components example

* docs(angular): fix config.json

* fix conflicts in lit package

* remove angular package non-fesm export

* since angular 19, ng-packgr only bundle a `fesm2022` export

* docs: exp virtual - remeasure when table state changes

* docs: virtualizer tbody from onchange

* update all angular examples

* fix conflicts in examples/react

* ci: apply automated fixes

* fix tests

* ci: apply automated fixes

* fix tests

* ci: apply automated fixes

* angular: update vite config to support vitest workspaces

* init shadcn example

---------

Co-authored-by: Riccardo Perra <[email protected]>
Co-authored-by: Lachlan Collins <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Tanner Linsley <[email protected]>
Co-authored-by: Riccardo Perra <[email protected]>
Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Luke Schierer <[email protected]>
Co-authored-by: Mor Kadosh <[email protected]>
Co-authored-by: Kevin Van Cott <[email protected]>
Co-authored-by: Kevin Van Cott <[email protected]>
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