where and how to write updatedata event in the cor

2019-08-29 10:54发布

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条回答
做自己的国王
2楼-- · 2019-08-29 11:36

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

查看更多
登录 后发表回答