Closed g-eoj closed 6 months ago
Hi @g-eoj,
I assume the reason you are experiencing losing focus is due to textbox recreation instead of just value update. @marek-mihok please verify.
Your assumption is correct, @mturoci.
https://github.com/h2oai/wave/assets/23740173/85cabed8-02f6-419c-b662-0f12c2244ac1
Please paste the code for @g-eoj here so that he has better time copy pasting the code and understanding what needs to be changed.
I got it to work. Thank you!
@g-eoj perfect! I'm pasting the code anyway if someone in future will look for this issue.
from h2o_wave import main, app, Q, ui
@app('/demo')
async def serve(q: Q):
# Make sure textbox is created only once by using `q.client.initialized`:
if not q.client.initialized:
q.page['example'] = ui.form_card(box='1 1 -1 -1', items=[
ui.textbox(name='textbox_trigger', label='Textbox with trigger', trigger=True),
ui.text(name='textbox_trigger_value', content=''),
])
q.client.initialized = True
if q.args.textbox_trigger is not None:
q.page['example'].textbox_trigger_value.content = q.args.textbox_trigger
await q.page.save()
Is your feature request related to a problem? Please describe
When typing in a textbox, if the trigger fires before I'm done typing, I have to reselect the textbox with my mouse to continue typing.
Describe the solution you'd like
Keep the textbox active upon a trigger.