View Full Version : How do I get a reference to a DataView itemTpl item?

8 Nov 2013, 10:40 AM
Having a bit of trouble with this one, not entirely sure why... I'm trying to use Ext.ComponentQuery.query but can't seem to get a reference to the items within the DataView. I know they should just be standard DOM elements, but even searching by classname I find nothing? Anyone have an example of doing this?

8 Nov 2013, 11:42 AM
The view items aren't instances of Ext.Component, so you can't use Ext.ComponentQuery. To query for DOM elements, you should use Ext.dom.Query (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.dom.Query). The best solution, though, is to just use the getNodes() (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.view.View-method-getNodes) method of the view to get the child items, no query required. Here's a small example: