动作处理程序不工作在View本身 [英] Action Handlers Not Working on View itself

查看:108
本文介绍了动作处理程序不工作在View本身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

行动处理程序不能直接在视图实例上工作?



我不想在视图中附加一个操作处理程序,而是将其直接附加在整个视图本身上。



示例jsFiddle: http://jsfiddle.net/t3wdG/



更新:



我的目标是委托具体parentView上的功能(在这种情况下,撤消,重做)。我有buttonView的原因是因为点击每个按钮,我想做一些事情,例如添加一个css类。



所以实际上,我想让我所有的按钮在点击上添加一个类,然后委托给父视图中的单独功能。



可以使用这种方法吗?



这是更新的jsFiddle: http://jsfiddle.net/xvkgk/

解决方案

好的,我不认为这是一个内置的方式,但是检查这个jsfiddle ,它似乎按照您的期望工作: http://jsfiddle.net/xvkgk/8/


Do action handlers not work directly on view instances?

Instead of attaching an action handler within the view, I want to attach it directly on the entire view itself.

Sample jsFiddle: http://jsfiddle.net/t3wdG/

UPDATE:

My goal is to delegate to specific functions (undo, redo in this case) on the parentView. The reason I have the buttonView is because on click on each button, I want to do something to it, for example add a css class to it.

So in effect, I want all my buttons to add a class to themselves on click and then delegate to separate functions on the parent view.

Is this possible using this approach?

Here is the updated jsFiddle: http://jsfiddle.net/xvkgk/

解决方案

Ok, I don't think there is a built in ember way to do that, but check this jsfiddle, it seems work as you expect: http://jsfiddle.net/xvkgk/8/

这篇关于动作处理程序不工作在View本身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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