Skip to content

Reliable user selection real time listener #76

@petkoivanov1

Description

@petkoivanov1

Hi,
I used the notebook linked below to test a real-time selection listener in different modes (table grouped or not).
In the process , I think I fixed 1 typo and a couple of bugs in grid.py

I still have one big issue : I cant get it to work with aggregated rows. Nothing fires at all.
image
Clicking anywhere on the Grouped columns (A in the screenshot) fires this:
{'data': [[]], 'index_rows': {'names': ['Index'], 'values': [[None]]}, 'index_columns': []}
Clicking on any other columns does not fire anything.
( Expanding the grouped row and clicking on leaf rows, works. )
Has any one been able to get that working?

https://github.com/petkoivanov1/ipyaggrid/blob/master/docs/notebooks/demo-ipyaggrid-selection-listener.ipynb

Thanks in advance,

P.S. here is a description of the fixes/ enhancements (from inside the notebook):

  1. ipyaggrid/ipyaggrid/grid.py : 241 should be 'range' not 'cols' ? I think so.
  2. to_df['columns'] = pd.MultiIndex.from_tuples(*[data_up['index_columns']]) does not handle one corner case well (selecting a grouped column) and is copy-pasted about 5 times over in grid.py

image

  1. additional .get_selected_columns() call after processing a 'rows' fire . With rangeSelectionEnabled, i get a 'range' fire, then a rows fire but never a 'cols' fire. I trigger it programatically after 'rows'. Seems to work well in ungrouped mode.
  2. refactored the monolithic 'export' method to smaller functions so it can be clearer what each piece does and can be overridden if needed.
  3. added grid_range_selection method for easy hook-up (in my test examples I just display on a separate Output widget).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions