Josh
Josh

Reputation: 1019

How to properly add listener for a control in controller?

I can successfully add a listener to the painted event in the view for a selectfield. But, how do I do this in the controller?

control: {
    "#form #field": {
        painted: 'onPainted'
    }
}
// omitted onPainted method that logs message in console

This doesn't work. However, directly adding a listener in the view works.

// in the view for the selectfield (works)
listeners: {
    painted: function() {
        console.log("Painted");
    }
}

What am I missing?

Upvotes: 1

Views: 1065

Answers (1)

bjudson
bjudson

Reputation: 4083

From a comment in the docs:

This event is not bubbled up to the controller, "for performance reasons".

Upvotes: 3

Related Questions