Is it possible to automatically insert a value set by code when adding a new row by using st.data_editor?
For example, created a st.data_editor with 2 lines. In the first column, there should always be an ascending number (1, 2, 3, etc.) instead of None. Is there any โniceโ way to implement this?
import pandas as pd
import streamlit as st
data_df = pd.DataFrame(
{
"widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],
}
)
st.data_editor(
data_df,
column_config={
"widgets": st.column_config.TextColumn("Widgets", default="st.")
},
hide_index=True,
num_rows="dynamic",
)
This will add a st. as the default value in every new row. Unfortunately, this can only be a static value currently and not something dynamic like an ascending number.