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

How to extract value when using element #32

Open
qingant opened this issue Jun 7, 2024 · 1 comment
Open

How to extract value when using element #32

qingant opened this issue Jun 7, 2024 · 1 comment

Comments

@qingant
Copy link

qingant commented Jun 7, 2024

with ui.element('div', className='w-full flex flex-row justify-between items-center', key='container') as div:
  print('DIV', div)
  a = ui.element('tabs', options=['All', 'Running', 'Ended'], default_value='All', className='mr-2', key='status_tabs')
  b = ui.element('tabs', options=['All', 'Winning', 'Losing'], default_value='All', className='mr-2', key='result_tabs')
  c = ui.element('div', className='flex-grow w-full')
  d = ui.element('input', placeholder='Search Experiment', className='border-none w-[50px] p-2 searchInput', key='search')

print(div,  div.state, div.key, div.children[0].key, d.state, d.value)

I have a piece of code like this, but unfortunately the value is actually populated to div.state. how could I get value of each element ? or at least have a way to figure out which element the value comes from ?

@Yemeen
Copy link

Yemeen commented Jun 29, 2024

From the experimental section of the docs

Another task to complete before making element a formal feature involves the handling of element values. When using nested elements, they share the same iframe and Streamlit values in the session state. Therefore, I need to slightly refactor the current value type to include the component key, allowing all components to share a single Streamlit value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants