Tuesday, August 13, 2013

Touch 2- Painted event not recognized/listened by the controller

In one of our projects, after upgrading to sencha touch 2.2, we noticed that the painted event was not being recognized in the controller. After a lot of search on the forums and google we somehow managed to get it working. Basically we need to add the following code in the view, whose painted event is being listened to in the controller:
  initialize: function() {
        this.callParent();
        this.relayEvents(this.element, ['painted']);
    }

2 comments:

  1. Stuck for hours, this was the most useful advice I came across.Thnks alot

    ReplyDelete
  2. You are Welcome!!.. Well though this will work, avoid the use of painted event in the application for performance reasons. you may use Activate/show instead. And That's the reason it can no longer be listened by the controller :) Sencha has done this on purpose. Though we always have workarounds ;)..

    ReplyDelete