I'm trying to get element by class name with Sencha Touch
itemswipe: function(dataview, index, element, e) {
console.log(element.select('.x-list-disclosure'));
}
but it returns this error:
TypeError: Result of expression 'element.select' [undefined] is not a function.
Here is the full code block
var list1 = new Ext.List({
flex: 1,
cls: 'list_simple',
sorters: ['firstName', 'group'],
itemTpl: '{firstName} {lastName}',
grouped: true,
groupTpl : [
'<tpl for=".">',
'<div class="x-list-group x-group-{id}">',
'<h3 class="x-list-header"><div class="header">{group}</div></h3>',
'<div class="x-list-group-items">',
'{items}',
'</div>',
'</div>',
'</tpl>'
],
onItemDisclosure: function(record, btn, index) {
Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName') + ' ' + record.get('lastName'), Ext.emptyFn);
},
listeners: {
itemtap: function(dataview, index, element, e) {
console.log('node is tapped');
},
itemswipe: function(dataview, index, element, e) {
console.log(element.select('.x-list-disclosure'));
}
},
store: store
});
(Added) This is the generated elements of {items}
:
<div class="x-list-group-items">
<div class="x-list-item x-item">
<div class="x-list-item-body">Melvin Gilbert</div>
<div class="x-list-disclosure"></div>
</div>
<div class="x-list-item x-item">
<div class="x-list-item-body">Jeaffrey Gilbert</div>
<div class="x-list-disclosure"></div>
</div>
</div>
Any ideas?
console.log(element)
. I wonder if the lib is broken, but I don't think so. – Jeaf Gilbertconsole.log(element);
inside youritemswipe
listener? – JamesHalsall.x-list-item
class. I added the generated item elements in the question. – Jeaf Gilbert