在哪里和如何以正确的方式写更新的事件 [英] where and how to write updatedata event in the correct way

查看:93
本文介绍了在哪里和如何以正确的方式写更新的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有几种方法可以做,但是不知道哪一个是正确:


  1. 内部配置



    配置:{
    updatedata:dataUpdated
    },
    dataUpdated:function(){
    .........
    }


2。

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

另外,我需要调用以下内容:
me.updatedata()听众功能?



如果我的代码出现问题,请更正我。



谢谢。 >

解决方案

您将在 config listeners c $ c>执行 Ext.define 时。在 Ext.create 项目中,您将把它们放在传递对象的根目录(不包含在code> config )



事件在 Sencha Touch活动指南


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.

解决方案

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

这篇关于在哪里和如何以正确的方式写更新的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆