zauberzeug / nicegui

Create web-based user interfaces with Python. The nice way.
https://nicegui.io
MIT License
9.74k stars 579 forks source link

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

Open python-and-fiction opened 1 week ago

python-and-fiction commented 1 week ago

Description

It is same as https://github.com/ag-grid/ag-grid/issues/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 commented 1 week ago

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 commented 4 days ago

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.

python-and-fiction commented 4 days ago

@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