mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
740 stars 55 forks source link

Should we offer support for Ag-Grid? #55

Closed mwouts closed 1 year ago

mwouts commented 2 years ago

Ag-Grid is a renowned JS table library.

It has a mixed community/enterprise licensing - see here for a description of the features available in either version.

Is there any user interested in seeing support for ag-grid in this project? (An experimental version is available in this branch)

If so, I'll need help to setup the default table size and style (cc @btribonde)

matrs commented 2 years ago

I recently used your library and I didn't have any previous experience with interactive tables in jupyter (o any other experience, I'm just learning JS). I saw Ag-grid during my search and also ipyaggrid, but I didn't try it because itables worked for me. What I missed, with my very brief experience, is be able to build more advanced tables in jupyter. For example, place plots or define expandable rows ( display more content after a click). From what I saw in the datatables documentation site, you can do almost everything you want, but I understand many of those "advanced" options aren't available in itables. Is Ag-grid an option that would allow to build more advanced tables in jupyter? from your developer point of view, will give you the chance to implement some options not easily implmentable in itables-datatables? Sometimes I use R and it has a couple of very advaced wrappers of these kind of JS libraries, and I missed that in python (well, i haven't tried ipyaggrid yet).

Also, as a vote for Ag-grid, I wanna add that for me, datatables being a plugin for jquery is a downside. I know that It's been one of the most used JS libraries for many years, but it seems to me that more and more JS developers aren't using it anymore, so as I'm learning JS , I won't use datatables because learning jquery is not in my plan.

mwouts commented 2 years ago

Hi @matrs , thank you for your input, that is very interesting.

My main objective for itables is to allow the user to display pandas Dataframes as interactive objects and benefit from the search & ordering capacities of a dynamic table. Also I think that the default rendering (without any configuration) needs to be as good as default Pandas, so that users don't need to learn JS nor a specific table library.

Of course I am also willing to support more advanced usages. Currently we support passing any parameters, including JS functions, to the DataTable() constructor.

As you point out, some more advanced usages like expandable rows require

  1. additional javascript functions - in the example of the expandable rows for datatables.net, that is the code below the line // Add event listener for opening and closing details
  2. and a custom preparation on the data.

At the moment, as discussed at #53 we don't support 1. but I think we could easily do that (please confirm if you want this by opening a dedicated issue).

The second item is also interesting. At the moment we assume that the data comes from a table, but in this expandable rows example I guess you need some additional metadata to decide which columns are shown and which are not. Similarly for plots - where do you expect to take the plot information from? From the same DataFrame, or from another data set?

Maybe I'll suggest that you open two additional issues, one for the expandable rows, with a sample data set and how you intend to use it, and the other one for the plots.

Regarding ag-grid, I share your concern about the dependency of datatables.net on jquery, however I have the feeling that there is not so much functionality in the community version of ag-grid (and in particular the expandable rows in ag-grid belong to the entreprise version).

Sometimes I use R and it has a couple of very advanced wrappers of these kind of JS libraries, and I missed that in python

I do have some experience with RStudio/DT which inspired this package, and with Plotly (works well in R and Python and many other languages). Would you recommend having a look at more packages? Can you share a few code snippets that highlight what you mean by advanced wrappers? Thanks!

jklap commented 1 year ago

I'm confused -- why wouldn't someone just use ipyaggrid?

I don't know that adding support for AgGrid to this project would be the best approach -- seems like you'd end up splitting your time and either only adding functionality to the lowest common denominator or end up with disjointed functionality when one table supports something the other doesn't? And you'd have to become an expert in both tools?

Unless you mean dropping DataTables and replacing with AgGrid -- that I can't really weigh in on since I've only played with AgGrid and not used for production needs

Personally I think DataTables probably solves for, certainly, your primary use case of being a drop-in replacement for Pandas table display with some caveats that we can probably better tweak out-of-the-box for better display (such as best-fix column sizing for example).

And yet you can still support some of the advanced usage for power users. Maybe buttons, use of plugins would be a key next-step focus area. For instance I'd LOVE to be able to do something with buttons!

mwouts commented 1 year ago

Hey @jklap , yes I agree, now providing support for ag-grid is completely off my radar, so I'll close this issue.

Personally I think DataTables probably solves for, certainly, your primary use case of being a drop-in replacement for Pandas table display with some caveats that we can probably better tweak out-of-the-box for better display (such as best-fix column sizing for example).

Thanks. Yes I agree! By the way you should give a try to itables==1.3.5 which has a much nicer display of wide tables (sorry it took me so long to figure out how to fix the column sizing!), and is also much faster at doing the downsampling of large tables.

And yet you can still support some of the advanced usage for power users. Maybe buttons, use of plugins would be a key next-step focus area. For instance I'd LOVE to be able to do something with buttons!

Yes that is coming... For that we had to way for a new release of datatables.net, which just arrived. Please subscribe to #50 if you want updates on this!