marimo icon indicating copy to clipboard operation
marimo copied to clipboard

Freeze Table Column

Open madystricker opened this issue 1 year ago • 6 comments

Description

It would be great to be able to mark the first column of a table static, similar to freezing the first column in an Excel table.

Suggested solution

Create a True/False initialization arg for the mo.ui.table() component that freezes the first column if True.

Alternative

No response

Additional context

No response

madystricker avatar Mar 20 '24 23:03 madystricker

I like that idea! We could allow for freezing the first row too.

akshayka avatar Mar 21 '24 02:03 akshayka

I can take a shot at this

hhk998402 avatar Jul 06 '24 00:07 hhk998402

hey @hhk998402 - that would be awesome! let me know if you need help or want to pair?

initial thoughts on how we can implement this:

  • add frozen_columns to mo.ui.table(frozen_columns=)
    • for an initial version it could just be a number (e.g. 1, 2), but for something more complex, we could make it a list of strings as well which maps to the column names to pin
  • Checkout frontend/src/components/data-table/column-wrapping for adding a custom table plugin
    • we can do something similar for frozen-columns
  • then somewhere in frontend/src/components/data-table/data-table.tsx we can use this new plugin to check column.isFrozen() && "sticky" to make the header sticky

mscolnick avatar Jul 10 '24 14:07 mscolnick

@hhk998402 Were you still working on this? If not, I'll grab this one next.

wasimxyz avatar Aug 11 '24 06:08 wasimxyz

@hhk998402 Were you still working on this? If not, I'll grab this one next.

Hey, I'm currently working on this and have almost fixed it, just some style issues TBD with Myles. I hope this won't bother you :P 🙂

metaboulie avatar Aug 11 '24 07:08 metaboulie

@metaboulie Oh nice! Looking forward to seeing it 🙂

wasimxyz avatar Aug 11 '24 14:08 wasimxyz

Closed by https://github.com/marimo-team/marimo/issues/970

mscolnick avatar Aug 27 '24 14:08 mscolnick