JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.27k stars 1.11k forks source link

Add Data table component #344

Open kaushalyap opened 3 years ago

kaushalyap commented 3 years ago

Currently there is no data table component (ex: JavaFx table view) in Compose Desktop which is useful for company internal applications.

There is data table component in Android Compose. but the problem with it is limited functionality. ex: no cell selection.

Please consider providing a data table component similar to JavaFx table view.

pacher commented 3 years ago

Totally agree (not enough buttons to upvote this), nice table component would be totally awesome. I hope it would be more advanced and tailored for desktop compared to the android one linked above which looks more like a simple thing for simple use cases on mobile and probably web.

Charts and tables are the major parts missing in compose for desktop development in my opinion.

TableView (and it's siblings like TreeView and TreeTableView) are very high level components and it is hard to design a good API for them. Especially notorious is TableView from JavaFX.

Now there is an opportunity to "make it right" in CFD ;-) I would love to see what the minds in JetBrains can come up with using all the expressive power of Kotlin.

jimgoog commented 3 years ago

This is one of those places that is a perfect opportunity for the community to create and share.

Any time that the core CFD developers spend writing widgets is time that they would otherwise have spent building core CFD features that unlock new capabilities and improve platform stability and compatibility.

If you could help us by building this widget yourself and sharing it with others, that would free us up to focus on the tasks that require more in-depth knowledge of the internals of Compose and thus are harder for the community to implement with but are more impactful because they make CFD better for everyone.

kaushalyap commented 3 years ago

I do agree with @jimgoog, it is better community support for widgets until the compose desktop matures. Since Kotlin have Java interoperability you can use JavaFx table view in the mean time.

@jimgoog If you people ported Android Compose data table to desktop, it will help the community to extend the data table while maintaining the consistent look of the material design.

pacher commented 3 years ago

@jimgoog I fully understand your point about limited resources. That's why I did not open such an issue myself, only upvoting and expressing the importance of table component for desktop applications (which is less so for mobile where compose is coming from). Because I see labels assigned to the issue which feels like CFD team is actually considering it.

However, the proper table is a complicated beast and might be too heavy for a pet-project. From the top of my head: resizing and re-arranging the columns by mouse dragging the column headers might be not so easy and "require more in-depth knowledge of the internals of Compose" or even some special optimizations to make it efficient. Sorting and filtering while keeping the position in the long and lazy scroll pane might be another.

mipastgt commented 2 years ago

Any news on this? What happened to the Jetpack Compose Datatables Could they be made available outside of the official Compose namespace so that we have at least something even if they may be not perfect yet? For almost any serious desktop application some kind of table is like a bread-and-butter component.

Stvad commented 2 years ago

Literally the first thing I googled when figuring out if I should use Compose 😅

lovehzj commented 2 years ago

+1, want this feature

galex commented 2 years ago

Yup that's definitely needed :)

jribs commented 2 years ago

This table is the only thing in the way of giving Desktop Compose a serious go. It's a must for dev ops/dealing with typical corporate hodgepodges of disparate data.

MarcusWolschon commented 2 years ago

Not the only thing (still have to use ancient Java AWT+Swing for printing) but a very important part.

feivur commented 2 years ago

There is good idea https://stackoverflow.com/a/71665355/2416823

beike6688 commented 2 years ago

The table is the component I desperately want

ctadlock commented 2 years ago

@olonho @akurasov What is the status of this? Its clearly the more requested feature in this whole project and it seems entirely ignored. Not listening to your users is a quick way for your product to fail.

kirill-grouchnikov commented 2 years ago

Just off the top of my head, a proper data table component in 2022 is expected to have all of these: grouping, filtering, single and multi-column filtering, pivots, multirow headers, footers, search, freezing rows and columns, pinning rows during scrolling, column / row / cell selection, nesting, cell spans. And there's more.

A particular person here who has starred or liked the issue might not need every single one of these, but in aggregate it adds up to a lot of interconnected features.

Bottom line is, and this is my personal opinion on it, you want such a component to be provided by an "entity" that is directly invested in the need for that component to exist. JetBrains as a purveyor of fine IDEs does not need such a component to exist. The very few tables that you can find in these IDEs are quite simple, and can be implemented as a LazyColumn with custom-laid out rows to maintain the "illusion" of the table structure.

It's been 18 months since the official inception of Compose, and at this point it is our responsibility as the community to step up and start providing such components. Maybe for free, and maybe as a commercial / paid offering. That is the only realistic way forward to have a fully-fledged data table with a robust feature set. It is time to convert the requests / demands to actions.

ctadlock commented 2 years ago

Just off the top of my head, a proper data table component in 2022 is expected to have all of these: grouping, filtering, single and multi-column filtering, pivots, multirow headers, footers, search, freezing rows and columns, pinning rows during scrolling, column / row / cell selection, nesting, cell spans. And there's more.

A particular person here who has starred or liked the issue might not need every single one of these, but in aggregate it adds up to a lot of interconnected features.

Bottom line is, and this is my personal opinion on it, you want such a component to be provided by an "entity" that is directly invested in the need for that component to exist. JetBrains as a purveyor of fine IDEs does not need such a component to exist. The very few tables that you can find in these IDEs are quite simple, and can be implemented as a LazyColumn with custom-laid out rows to maintain the "illusion" of the table structure.

It's been 18 months since the official inception of Compose, and at this point it is our responsibility as the community to step up and start providing such components. Maybe for free, and maybe as a commercial / paid offering. That is the only realistic way forward to have a fully-fledged data table with a robust feature set. It is time to convert the requests / demands to actions.

That's a pretty good straw man.

Given this project is wrapping Material, how about starting with what exists there: https://material.io/components/data-tables

None of that is an excuse for ignoring your users by not responding to a very popular feature request for over a year.

christoph-grimm commented 2 years ago

Anyhow ... it is a free project. Everybody in the community who needs such a table might contribute it. I understand that Intellij staff had other priorities, in particular considering the fact that Compose Desktop in priority needed a more sustainable basis -- that had evolved over the last year. Happy to see API is now stable enough to start such components, for whoever is willing to contribute.

Your link to Material is a good start in a good direction. I wonder where we might publish such components developed by the community (or, even where we might publish a starting point as posted above).

kirill-grouchnikov commented 2 years ago

Given this project is wrapping Material, how about starting with what exists there: https://material.io/components/data-tables

Compose is a UI toolkit that is built on principles of a reactive programming model. Material is a cross platform design library.

The core distribution of Compose happens to have a particular implementation of the Material design library that target the Android platform. That distribution does not implement all the components from the Material design library - as a quick look at the link would show.

Compose-JB is a port of the core distribution of Compose that aims to make Compose available on additional platforms, such as desktop, web and others.

Compose-JB does not wrap Material (I don't even know how to try and parse that original comment). Neither does the Material library provide implementations of the table component for Android or iOS.

I guess you can kind of argue that you can start from an existing implementation of the data table in Flutter and port that to the Compose world, be it Android-only, desktop-only, or true cross-platform. If that is the argument, and that is the fatal flaw of the entire project, and that is the only thing that is holding it back - where is the community response to pick up this challenge and run with it?

adamsiembida commented 1 year ago

I guess you can kind of argue that you can start from an existing implementation of the data table in Flutter and port that to the Compose world, be it Android-only, desktop-only, or true cross-platform. If that is the argument, and that is the fatal flaw of the entire project, and that is the only thing that is holding it back - where is the community response to pick up this challenge and run with it?

I'm one of the people that wants to use something like compose, but the lack of table functionality is holding me back. Part of the reason I suspect people haven't "picked up the challenge and run with it" is because not having the table feature is preventing people from even trying Compose in the first place.

I've compiled some basic examples to see how Compose Desktop works, but I haven't gotten past that because of said missing table. You mention Flutter, but that has the same problem. Compose Desktop and Flutter are still very mobile-oriented with desktop features added on, and that's just not enough for a lot of desktop developers to make the switch over just for some better programming model. I've been using JavaFX for a lot of apps, and it does everything I need, so why switch over to a new tool that is missing a lot of the desktop basics?

As others have said, making a well designed table is not an easy task, so it's not feasible for someone who is in the evaluation stages of Compose Desktop to just hop in and "run with it." On the other hand, people already using Compose Desktop are probably making the kind of apps that don't require those advanced desktop features, so they aren't likely to spend the effort making table functionality; hence, why the table is a good feature for the core Compose Desktop authors to work on.

Blacklands commented 1 year ago

I agree with @adamsiembida, for what it's worth. A table is a relatively complicated component, at least if it's supposed to have good performance even for large collections. Hell, even JavaFX has had a long list of issues and bugs with its TableView, and there is still a severe performance issue with it to this day, iirc.
That's really not a component that every user should be "re-inventing" by themselves, if you ask me. It's also a very basic component for desktop applications. If you have any collection of data and it's more complex than single values, you probably want a table, no?

I honestly can't imagine using Compose for a desktop application as long as I can't have at least a simple (but performant) table going with a few lines of code. And then there's actually editing table values, re-sorting the table by a specific column, drag-moving columns, correct resizing of rows when the text is styled, etc pp...

kirill-grouchnikov commented 1 year ago

I think it comes to the intersection of three things: resources, competency and motive.

For the motive, there's an excellent argument to be made that a desktop-grade toolkit needs a desktop-grade grid component. That is, if you see this project's main goal to bring Compose to desktop. But it's not. It is to bring Compose into the multi-platform world. Desktop is a part of this world, indeed, but one can also make an argument that a lot of developer attention and products have shifted away from the world of desktop in the last decade or so.

For the competency, and not implying in any shape or form that JB doesn't have people that couldn't write a grid component given enough time, but the core business of the company seems to be a line of (absolutely fantastic) IDEs. Desktop grade apps indeed. But apps that do not need any sort of complex data grids.

For the resources, it would seem that the JB team working on Compose is already stretched super thin trying to bring Compose to the multi-platform world. A full featured and performant data grid is a full-time job for a 5-10 person team over a number of years. It doesn't seem that there are resources right now available to allocate such a team.

So yes, again speaking realistically and pragmatically, that it doesn't look that JB is going to provide such a grid component in the near future, and it is on the collective "us" the community to step up, collaborate if needed, and walk the walk.

jimgoog commented 1 year ago

@adamsiembida

I've been using JavaFX for a lot of apps, and it does everything I need, so why switch over to a new tool that is missing a lot of the desktop basics?

If JavaFX has the table you desire, you can use the interoperability APIs (https://github.com/JetBrains/compose-jb/tree/master/tutorials/Swing_Integration) to call that table from Compose, using Swing as an intermediary.

@Blacklands

That's really not a component that every user is supposed to "re-invent" by themselves, if you ask me. It's also a very basic component for desktop applications. If you have any collection of data and it's more complex than single values, you probably want a table, no?

It doesn't require every use to "re-invent" by themselves. It requires a single person (or more likely, group of people who care) to step up and build it once, and be willing to share with others.

@kirill-grouchnikov Mostly agree, except:

That is, if you see this project's main goal to bring Compose to desktop. But it's not.

In a sense, it is a goal - We do want to make a first class development experience on all platforms, including Desktop. I don't think it's a lack of desire, but just a matter of prioritization for this particular widget. Data table is a complex element, with many tradeoffs to balance, and it will require substantial design work to make one that everyone likes. I think we intend to support these types of widgets eventually, but we can't do everything ourselves, and we certainly can't do everything all at once. So we're trying to prioritize the most common widgets and balance time spent writing widgets with time spent creating some of the next generation technologies that will open the doors to whole new classes of opportunities.

As I mentioned earlier in this thread:

Any time that the core CFD developers spend writing widgets is time that they would otherwise have spent building core CFD features that unlock new capabilities and improve platform stability and compatibility.

If you could help us by building this widget yourself and sharing it with others, that would free us up to focus on the tasks that require more in-depth knowledge of the internals of Compose and thus are harder for the community to implement with but are more impactful because they make CFD better for everyone.

This DataTable is something that can be implemented entirely in userland, so at least for the time being, it is better implemented by someone in the community. Many hands make light work.

wispborne commented 1 year ago

If JavaFX has the table you desire, you can use the interoperability APIs (https://github.com/JetBrains/compose-jb/tree/master/tutorials/Swing_Integration) to call that table from Compose, using Swing as an intermediary.

As long as you cannot display modals, tooltips, or any other Compose component over a Swing panel, it's pretty worthless except for very specific UIs, such as when you are able to make the panel a standalone window.

jimgoog commented 1 year ago

@davidwhitman Yep, that's fair/true. Once you take the escape hatch, the content within your data table would likely end up being Swing/JavaFX too. Also, I doubt their data table provides a nice declarative API. No question a data table written in pure Compose would be a nicer developer experience.

olk90 commented 1 year ago

In one of my own projects, I've been missing a table-like composable as well. So I tried to build my own rudimentary implementation. Maybe it helps somebody else, too: https://github.com/olk90/compose-tableView

I'm sure though, there is plenty of room for improvements :smile:

sheepdreamofandroids commented 1 year ago

I really would love to have a datatable/grid component as well. At the same time I see how that would be a serious resource drain on the compose team. Also there are probably a million variations possible on the theme so I don't really expect it to happen. Probably a much better use of the time of the compose team would be a site like pub.dev (for Flutter) with an easily searchable index of all compose components that can be filtered for environment etc. Or maybe it's just that I'm a newbie and that site already exists but I can't find it.

conchis commented 1 year ago

I do wish I had time to create a great data grid component from scratch, but I really don't at the moment. Since my back-end code is already Kotlin, it would be great to be able to use Compose for front-end development. Alas, tables are very basic to my work, so I will look for other alternatives. Some day, I hope, Kotlin will be ready for full-stack data centered applications. I suspect many others are in the same situation.

sproctor commented 1 year ago

I'll throw my 2 cents in here. The data table implementation in early dev versions of Compose was removed because it relied on APIs that were being removed. I've ported that implementation to Compose 1.4 and added some modest functionality, because it was nearly unusable as it was.

https://github.com/sproctor/compose-data-table

If you're looking for a simple table, it works. My priorities for future development are improving and stabilizing the API, adding sorting functionality, getting data from androidx paging (or multiplatform paging), and supporting pages per the M2 spec. I would love some feedback on what other people's priorities are and on the API design.

ddkwork commented 8 months ago

https://primevue.org/treetable

jjhax commented 4 months ago

This is insane that such a basic UI feature is not implemented. Every UI framework known to date has a table. Desktop developers need them more than most. And since compose is geared towards all platforms inc. desktop why isn't this a feature?

Imagine all the man hours gone into alternative Java UI frameworks over the years ... that have died. Those wasted hours could have been used to improve Swing. Swing was perfect with it's theming and still works great today ... unless you're on MacOS. Which is why I'm here using compose.

Jetbrains gets money off it's customers, they can do this. They just wont. Ignoring what developers want because they can't be bothered to put the hours and money into solving the problem.

After I've finished this current project, I wouldn't recommend compose to anyone.

dima-avdeev-jb commented 4 months ago

@jjhax Hello! We understand the need for a robust table component, and we do want to provide one eventually. Unfortunately our developer resources are limited and other features have been deemed even more critical at the moment.

pablichjenkov commented 4 months ago

I have this one saved from long ago. Not sure if it can help. https://github.com/oleksandrbalan/lazytable

sproctor commented 4 months ago

@jjhax Most of what Jetbrains has done has been to bring Compose to the desktop. They've created very few custom UI elements that weren't already part of Compose, but they have done an amazing job of making what was written for Android work on the desktop.

Just in this thread you had 2, now 3, Compose libraries to give you that functionality and you have the option to embed a Swing component.

windedge commented 4 months ago

Just added another showcase if you're interested: https://github.com/windedge/compose-table

The API is inspired by @sproctor's https://github.com/sproctor/compose-data-table with slight changes to fit my needs.

elkhoudiry commented 3 months ago

Hello Everyone yesterday i found this issue and it seems like there is no official DataTable implementation so i created one quickly with some basic features that fits my needs for now

https://gist.github.com/elkhoudiry/a462fd277e2531d541932f2217ab3687

simplescreenrecorder-2024-03-16_19 01 06 (6)