0

I want call onclick event after form loaded. I not found onCompletion Event or any analog

something like : kind: someUI, onComplete: "Init"

AC1D
  • 248
  • 5
  • 16

2 Answers2

1

I'm not entirely sure from your description, but it sounds like you want to cause some action to occur when the app is loaded. You might try using ready() as described in the getting started guide.

http://enyojs.com/docs/latest/developer-guide/getting-started/creating-and-building-an-app.html

The other choice is to add something to your initial App rendered that executes your buttonTapped() method.

rendered: function () {
    this.inherited(arguments);
    this.doSomething();
}
Pre101
  • 2,370
  • 16
  • 23
  • Thanks for answer, you right i need call action after app loaded. I use ready() function but have problem with binding it with components. I changed question for better understanding. – AC1D Mar 07 '17 at 04:24
  • Can you give init app render example? – AC1D Mar 07 '17 at 04:28
0

I solve it. I rewrite code like this

     {kind: IconButton, src: '@../../assets/info.png', ontap: "buttonTapped"},

create: function() {
                this.inherited(arguments);
                this.ServiceReq();
            },

    buttonTapped: function(inSender, inEvent) {

        this.ServiceReq();  
        return;

    },

    ServiceReq: function()
        { console.log('Clicked');}

But I'm not sure this is a good solution, but it works

AC1D
  • 248
  • 5
  • 16
  • As I mentioned in my answer, you should use [rendered()](http://enyojs.com/docs/latest/#/kind/enyo/Control/Control:rendered). `create()` is called before components are rendered onto the page so you won't have controls that can respond. I updated my answer to show `rendered()` – Pre101 Mar 07 '17 at 20:47