Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Unable to trigger a click-event in onAfterRendering

$
0
0

Hello everyone,

 

In our desktop application I have built the main navigation using button controls, where each button loads a defined view. My idea is that the default view is loaded by triggering a click-event on the first button once the page has loaded. Unfortunately, it's not working as expected.

 

The basic code I am running is:

 

onAfterRendering : function() {

    $('#navigation button').eq(0).click();

},

 

After which nothing happens. What confuses me though is that if I run:

 

onAfterRendering : function() {

    console.log($('#navigation button').eq(0), $('#navigation button').eq(0).click);

},

 

I get exactly what you'd expect; the right button and the function reference.

 

Object[button#__button0.sapUiBtn]function()

 

So the button is present in the DOM, it can be found and the function click(...) exists. Furthermore, if I run the code in e.g. Firebug's console, the event is triggered just fine.

 

What am I missing here?


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>