Skip to content

AG-Grid's 'rowSelection': {'mode':"multiRow",'headerCheckbox':False} won't work #3854

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

Open
python-and-novella opened this issue Oct 10, 2024 · 6 comments
Labels
blocked Status: Blocked by another issue or dependency dependencies Type/scope: Third party libraries
Milestone

Comments

@python-and-novella
Copy link
Contributor

Description

It is same as ag-grid/ag-grid#8855
Following code won't work as expected.

from nicegui import ui

grid = ui.aggrid({
    'defaultColDef': {'flex': 1},
    'columnDefs': [
        {'headerName': 'Name', 'field': 'name'},
        {'headerName': 'Age', 'field': 'age'},
        {'headerName': 'Parent', 'field': 'parent', 'hide': True},
    ],
    'rowData': [
        {'name': 'Alice', 'age': 18, 'parent': 'David'},
        {'name': 'Bob', 'age': 21, 'parent': 'Eve'},
        {'name': 'Carol', 'age': 42, 'parent': 'Frank'},
    ],
    'rowSelection': {'mode':"multiRow",'headerCheckbox':False},
    
}).classes('max-h-40')

ui.run(native=True)

E5NCGJC5{9{3(KOODE P52M

When i upgrade ag-grid to 32.2.1, it works well.
6 D5EYT52YGFI {~1VJG@4P

@falkoschindler
Copy link
Contributor

Thanks for reporting this issue, @python-and-fiction!
It looks like we would need to upgrade from our current AG Grid version 32.1.0 to at least 32.2.1 or the most recent 32.2.2. Usually we only upgrade dependencies for major releases. But I guess going from 32.1 to 32.2 shouldn't introduce breaking changes.

@falkoschindler falkoschindler added this to the 2.4 milestone Oct 11, 2024
@falkoschindler falkoschindler added the bug Type/scope: A problem that needs fixing label Oct 11, 2024
@falkoschindler
Copy link
Contributor

Unfortunately, upgrading from 32.1 to 32.2 breaks existing behavior, e.g. calling the "selectAll" method doesn't work without specifying the "rowSelection" option.

@python-and-fiction Is it possible that the feature you're describing didn't exist in AG Grid <=32.2? I just tried your code with NiceGUI 1.4.37 and it doesn't work either. In this case, this issue isn't a bug but a feature request. And since it depends on upgrading third-party libraries, it would need to wait for NiceGUI 3.0.

@falkoschindler falkoschindler removed the bug Type/scope: A problem that needs fixing label Oct 15, 2024
@falkoschindler falkoschindler removed this from the 2.4 milestone Oct 15, 2024
@python-and-novella
Copy link
Contributor Author

python-and-novella commented Oct 15, 2024

@falkoschindler yes, https://github.com/ag-grid/ag-grid/blob/v32.1.0/community-modules/core/src/main.ts has no RowSelectionOptions, it was added in https://github.com/ag-grid/ag-grid/blob/v32.2.0/community-modules/core/src/main.ts

@falkoschindler falkoschindler added this to the 3.0 milestone Oct 17, 2024
@falkoschindler falkoschindler added the dependencies Type/scope: Third party libraries label Oct 17, 2024
@mockey
Copy link

mockey commented Feb 20, 2025

I was playing around with aggrid and found this issue.
@falkoschindler Did you try with a current version?
There have been changes in 33.0.0:
https://www.ag-grid.com/changelog/?fixVersion=33.0.0 (filter summary with 'selectall')
Arguments in selectAll are defined as optional, so selectAll() should actually work.

If you don't want to upgrade before 3.0: Is it possible to override the library path for aggrid somehow?

@falkoschindler
Copy link
Contributor

@mockey Sorry, we can't upgrade to version 33 yet due to possible breaking changes. The changelog is quite long and it's hard to foresee which change might cause trouble in productive NiceGUI apps.

The easiest workaround might be this:

  1. Copy NiceGUI's aggrid.py and aggrid.js into your project directory.
  2. Download ag-grid-community.tgz from https://github.com/ag-grid/ag-grid/releases and extract ag-grid-community.min.js into your project directory.
  3. Change relative imports in your aggrid.py to from nicegui import ..., from nicegui.awaitable_response import ... and so on.
  4. Update the dependencies=[...] argument in aggrid.py to point to the downloaded ag-grid-community.min.js.
  5. Use AgGrid from your local aggrid.py in your app.

If all goes well, the resulting grid should have slightly different look and feel:

Image

@mockey
Copy link

mockey commented Feb 27, 2025

@falkoschindler

Sorry, we can't upgrade to version 33 yet due to possible breaking changes.

I see.

The easiest workaround might be this

Thanks for the detailed instruction. I might give this a try.

@falkoschindler falkoschindler added the blocked Status: Blocked by another issue or dependency label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Status: Blocked by another issue or dependency dependencies Type/scope: Third party libraries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants