Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify different column widths in render.DataGrid() #1324

Open
mdaeron opened this issue Apr 19, 2024 · 0 comments
Open

specify different column widths in render.DataGrid() #1324

mdaeron opened this issue Apr 19, 2024 · 0 comments

Comments

@mdaeron
Copy link

mdaeron commented Apr 19, 2024

Is there a canonical way to specify different column widths in render.DataGrid()?

In the following example, I'd like to keep columns a and b at a reasonably small width, while allowing column c to expand enough to accommodate long lines of text.

from shiny import App, Inputs, Outputs, Session, render, ui
import pandas as pd

df = pd.DataFrame(
  {
    "a": [0],
    "b": [0.1],
    "c": ["A very long line that goes on and on and on"],
  }
)

app_ui = ui.page_fluid(
  ui.card(
    ui.output_data_frame("odf"),
  ),
)

def server(input: Inputs, output: Outputs, session: Session):

  @render.data_frame
  def odf():
    return render.DataGrid(df)

app = App(app_ui, server)
Screen Shot 2024-04-19 at 16 04 41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant