deephaven / deephaven-plugins

Deephaven Plugins
5 stars 12 forks source link

UI Table on_cell_press gets the wrong data #529

Closed mattrunyon closed 6 days ago

mattrunyon commented 1 month ago

Description

on_cell_press (and the other press handlers) are using the visible index to fetch from the model. The model expects the model index. This means if the user has rearranged any columns, the value will be incorrect.

Steps to reproduce

  1. Run this Python code

    from deephaven import empty_table
    from deephaven import ui
    
    @ui.component
    def my_table():
        t = empty_table(50).update([
            f"A{i} = i + {i}" for i in range(3)
        ])
    
        return ui.table(t, on_cell_press=print)
    
    t = my_table()
  2. Click A2 top cell. Should print [2, 0] and value 2.

  3. Swap columns A2 and A1.

  4. Click A1 top cell (the new top right cell)

Expected results

  1. Prints [2, 0] { value: 1 }

Actual results

  1. Prints [2, 0] { value: 2 }. The value from A2

Versions

Deephaven UI 0.14.0