where and how to write updatedata event in the correct way

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 19:51:25

问题


I want to add a listener which listens to updatedata event in my custom component.

I have several ways to do it, but don't know which one is correct:

  1. inside config

    config:{ updatedata:"dataUpdated" }, dataUpdated: function() { ......... }

2.

config:{
  listeners:{
     updatedata: function(thisComponent, newData, eOpts){
              ..............
     }
  }
}

Also, do I need to call something like: me.updatedata() within the listener function?

Please correct me if something wrong in my code.

Thank you.


回答1:


You would wrap listeners in config when executing Ext.define. During Ext.create, or in items you would place them at the root of passed object (not wrapped in config)

Events are explained in details in Sencha Touch Event Guide



来源:https://stackoverflow.com/questions/24051274/where-and-how-to-write-updatedata-event-in-the-correct-way

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!