Using invisible `drawer`
Hey all.
I'm trying to refactor an app to not have
drawer
inside list
component, and to set up a single invisible drawer outside of the list component, and use a lightweight button to open and close it.
Now, opening the drawer with button is simple enough - but how, inside the drawer
, do I reference data of the particular list item which button I clicked?
Say, the list has id= a
, it contains text component (b
) and button ( c
), and drawer has id= d
. Drawer contains a text component e
that is supposed to show value of a.result.selectedRow.b.result
or something like that, but I can't figure it out. Please help.8 Replies
when you press the button, store the index in the state
then reuse that index
so button press -> frontend script -> set state + open drawer
Ok, so I'm gonna tell you what I managed to do with that advice, and I would like you to tell me exactly how wrong I got it.
1. I added inline script for the button with the following code:
(pardon Python, I don't speak JS very well)
2. I connected the
tool_index
input to the index of the list item by setting it to iter.index
3. Inside the drawer, I have a text component that is supposed to render date:
Where bg_1
refers to the runnable that fuels the list, c
is the button which state holds tool_index
It works, but I wonder if this is how it's supposed to work. Hope I don't come off as presumptuous 🙂 I really appreciate your work.SOrry I was unclear, that's not how it's supposed to work 😄
YOu need to use frontend script directly
so that it's executed in your browser
and can manipulate the browser state directly
you're doing an uncessary api call to set and retrieve the state as well as an unecessary compute
Do you think your team can create some helper article about that? 'Cause I have no idea how to do that.
state.item = iter.index
open('<draweritem>')
If I understood you correctly, the date then should be referred to as
... Right?
probably yes
thank you!