Selection of rows is not persisted when Tabulator is sorted?

Hi,

I think I’ve spotted a bug (or several bugs) in the Tabulator widget around the selection feature.

I’m using Panel 0.12.4 on Python 3.9.6 on Windows 10.

Here is the code to reproduce the issue:

    import panel as pn
    import pandas as pd
    import numpy as np

    pn.extension("tabulator")

    dates = pd.date_range(
        start=np.datetime64("2021-09-01"), end=np.datetime64("2021-10-30")
    )
    numbers = pd.Series(np.arange(100, 160))
    df = pd.DataFrame({"Dates": dates, "Numbers": numbers})

    table = pn.widgets.Tabulator(
        df,
        name="Dates",
        disabled=True,
        show_index=False,
        selectable="checkbox",
        pagination="remote",
        page_size=10,
    )

    row = pn.Row(table)
    pn.serve(
        row.servable(),
        title=f"REPRO",
    )

Steps to reproduce:

  1. Run the above code.
  2. Select a few rows in the table.
  3. Click the Numbers column header to sort the table by it in descending order.
  4. Click it again to sort by descending order.

Actual behavior:
The rows you selected are no longer selected.

Expected behavior:
The rows should remain selected regardless of the order in which the table is sorted.

Here’s an animated gif of what I’m experiencing:

U3CQhyXDFB

Two additional unexpected behaviors:

  1. Occasionally the dates in the Dates column turn into seconds since unix epoch time.
  2. Occasionally the paging buttons stop working.

Are these one or more bugs or am I missing something in my code? Should I open GitHub issues for these? If they’re bugs, I’d like to help fix them.

Thanks,
urig