import streamlit as st import pandas as pd import json import streamlit.components.v1 as components # 假設有一個 DataFrame df = pd.DataFrame({ "訂單單別": ["A", "B", "C"], "訂單單號": [101, 102, 103], "客戶簡稱": ["客戶1", "客戶2", "客戶3"], "備註": ["備註A", "備註B", "備註C"], }) # 將 DataFrame 轉成 JSON 格式 data_json = df.to_json(orient="records") # 撰寫 HTML 與 JavaScript,利用 Tabulator 顯示資料 html_code = f"""
""" # 使用 Streamlit 的 components.v1.html 嵌入此 HTML 頁面 components.html(html_code, height=600, scrolling=True) st.write("這是一個使用 Tabulator 顯示資料的基本範例。")