This is my XML fragment. I added this fragment in my main view. I know the fragment doesn't have its own controller, it uses main view controller. Here I added one event listener to HTML
<canvas>element and tried to handle it in main controller. But this event is not triggering. How to handle this event?Can I write my own logic for this event using JavaScript or do I have to use a controller for this?
<VBox xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" class="sapUiSmallMargin"> <!-- ... --> <html:canvas id="AnnCanvas" width="500px" height="500px" onclick="canvasCalled()" style="border:1px solid red; background-color:green; position:absolute;"></html:canvas> <!-- ... --> </VBox>
Like this, I added event for canvas in my controller file:
canvasCalled: function () {
MessageToast.show("canvas Called");
},