Managing user actions in an OWL component
To make the user interface interactive, components need to handle user actions such as click, hover, and form submission. In this recipe, we will add a button to our component, and we will handle a click event.
Getting ready
For this recipe, we will continue using the my_library
module from the previous recipe.
How to do it...
In this recipe, we will add a delete button to the component. Upon clicking the delete button, the component gets removed. Perform the following steps to add a delete button and its event in the component:
- Update the QWeb template and add an icon to remove the bar:
static template = xml` Â Â Â Â <div class="bg-info text-center p-2"> Â Â Â Â Â Â Â Â <b> Welcome to Odoo </b> Â Â Â Â Â Â Â Â <i class="fa fa-close p-1 float-right" Â Â Â Â Â Â Â Â Â ...