widgetti / ipyaggrid

Using ag-Grid in Jupyter notebooks.
MIT License
56 stars 14 forks source link

How to use Server-Side Row Model for ag-Grid #46

Open maxkoretskyi opened 1 year ago

maxkoretskyi commented 1 year ago

This example of how to use ipyaggrid shows the initialization of the agGrid with a fully loaded data (frame), which corresponds to the client-side row model.

g = Grid(grid_data = data, grid_options=grid_options, export_mode="buttons", theme='ag-theme-balham')

Does ipyaggrid support agGrid in the Server-Side Row Model? If so, where can I read about it? If not, could you give me some guidelines on what I should do to enable it?

I've studied the sources a little. Seems like that this use case is not supported. Inside widget_builder.js seems to be the only place where you inject the data:

    // instantiate grid
    const grid = new Grid(gridDiv, gridOptions);
    window.grid = grid;

    // inject gridData
    gridOptions.api.setRowData(gridData);

Maybe under your guidance I could implement the support for the SSR mode for agGrid and create a PR? Since agGrid's SSR model basically requires just a datasource object with getRows method, we could create it in python env and pass it to Grid during the instantiation

g = Grid(datasource= ds, 
mariobuikhuizen commented 1 year ago

You're correct that ipyaggrid currently doesn't support agGrid's Server-Side Row Model. It's an area that we think would benefit the package, and we appreciate your interest in contributing.

Given the potential complexities of implementing this feature, we think that creating a new widget specifically for this functionality would be the most prudent approach. This would allow us to maintain compatibility for users who are already using the existing Grid widget.

While our team may not have the bandwidth for extensive guidance, we're definitely open to receiving a PR.

maartenbreddels commented 1 year ago

To clarify, the new widget could live in the ipyaggrid package as a new widget, it does not need to be a new ipywidget library/package.