What I’m trying to do:
I would like to simulate the click event on a datepicker component in order to open up the date selection modal as soon as the component is shown on screen
Is this possible?
What I’m trying to do:
I would like to simulate the click event on a datepicker component in order to open up the date selection modal as soon as the component is shown on screen
Is this possible?
Hi there,
I would guess that Stu’s augment library (likely in the Anvil Extras library) can do that.
Give the forum a search for that and see what you can find out.
If it doesn’t work with the library @campopianoa mentions, then mention it here and it can easily be updated. I haven’t tried triggering click events on date pickers.
I looked into that library. It seems like it is only used for adding additional events and handlers to anvil components, not for triggering ones that are already in place. I tried doing something like
augment.add_event(self.date_picker_1, 'click')
self.date_picker_1.trigger('click')
and nothing happens because I didn’t set an augment event handler.
Ok I got it to work. Needed to do:
import anvil.js as _js
from anvil.js.window import jQuery as _S
_S(_js.get_dom_node(self.date_picker_1)).trigger('click')