ViewController config for view's DOM element?

41 views
Skip to first unread message

Chad Glendenin

unread,
Jun 11, 2014, 1:44:53 PM6/11/14
to def...@googlegroups.com
In a particular Sencha Touch app, I think I need to listen for the 'tap' event on a DOM element, because, for various reasons, I need an entire container and its content to be "tappable." Is there a way to do that in the `control` block in a Deft ViewController?

Basically, I want to replace the following legacy code in an old view class with something in a Deft VC:

config: {
...
listeners: {
tap: {
element: 'element',
fn: 'onElementTap'
}
}

Or is there a better approach? (This one is sort of a hack, but it's simple and effective.)

Thanks!

Brian Kotek

unread,
Jun 11, 2014, 3:17:28 PM6/11/14
to deftjs
Not sure if that will work. The addListener() method of Observable is different than the one for AbstractComponent (http://docs.sencha.com/extjs/4.2.1/source/AbstractComponent.html#Ext-AbstractComponent-method-addListener). It has extra logic to locate the DOM object and pass it to the listener in options.element.

Since you'd need the actual reference to the DOM object itself, I think you'd need to set up the listener yourself using this.addComponentSelector() or your own addListener().


--
Deft JS home page: http://deftjs.org/
Wiki: https://github.com/deftjs/DeftJS/wiki
For rules and tips on asking questions on the Deft JS mailing list: https://github.com/deftjs/DeftJS/wiki/Asking-Questions-on-the-Mailing-List
---
You received this message because you are subscribed to the Google Groups "Deft JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deftjs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/deftjs/CABetDDtSJ5d_yXcu5mESUj-GNMwW3Mtde_GuoE70Q%3DXLOTt8RQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages