Closed Haaaaaaaaaland closed 11 months ago
Hello,
Thank you for providing the card feature!
When using multiple cards, how can I get click results for each card? For instance, with the following code:
hasClicked1 = card( title="111", text="Some description", image="http://placekitten.com/200/300", key="111", on_click=lambda: print("111"), ) hasClicked2 = card( title="222", text="Some description", image="http://placekitten.com/200/300", key="222", on_click=lambda: print("222"), ) print(f"{hasClicked1} {hasClicked2}")
When 111 is clicked, the result is:
True False # print
And click 222, the result is:
True True # print ...?
Since I only clicked on the "222" card, I hoped that "False True" would come out, but it didn't work as expected.
How can i fix it?
Thank you in advance for your response!
Try using experimental_rerun()
experimental_rerun()
if hasClicked1 or hasClicked2: st.experimental_rerun()
Something like that, since the state of cards are persistent.
@Haaaaaaaaaland is your issue solved?
Hello,
Thank you for providing the card feature!
When using multiple cards, how can I get click results for each card? For instance, with the following code:
When 111 is clicked, the result is:
And click 222, the result is:
Since I only clicked on the "222" card, I hoped that "False True" would come out, but it didn't work as expected.
How can i fix it?
Thank you in advance for your response!