I’m new to streamlit-aggrid. I have a CSV file I want to load to a dynamic table and allow editions to only some of the columns. I saw this example:
import streamlit as st
import pandas as pd
from st_aggrid import AgGrid
df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]})
grid_return = AgGrid(df, editable=True)
new_df = grid_return['data']
So I’ve followed it, but let’s say that instead of editable=True, that allows both col1 and col2 values to be modified, I want to allow modifications on one of them (not important which one).
How can I do that please? Thanks!
I tried to pass a columns subset into the editable args but it is only accepting boolean values.
Hi @secret, I had written a similar code (Ag-Grid component with input support - #236 by Shawn_Pereira) which you can refer to. However, this was for aggrid version 0.2.3. I currently use version 0.3.3. Between then and now there are changes in syntax. If you plan to test the code from the link and are using 0.3.3 then you need to make the following changes:
delete the line theme="streamlit",
Lines similar to dta['data']['Amt'][i] would now be dta['data'][i]['Amt']
hi @Shawn_Pereira, i Used ag-Grid in Streamlit to create a 2x10 DataFrame, where the first column has random values between 0 and 1, and the second column has random values. i want to add the condition such that if the value of the row in the first column is 1, then the value of the corresponding row in the second column can be edited otherwise it cannot be edited. help me thank you very much.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.