PDA

View Full Version : Adding Listener to the List component failed, is it a bug ?



Eugene Krivopaltsev
26 Oct 2010, 10:00 AM
I am prototyping with Sencha Touch, and use List component.

I have following fragment in my code:

var list = new Ext.List({
tpl: '<tpl for="."><div class="contact">{firstName} <strong>{lastName}</strong></div></tpl>',

itemSelector: 'div.contact',
singleSelect: true,
grouped : false,
indexBar : true,
store: store,
width : 350,
height : 370,
modal : false,
hideOnMaskTap: false,
listeners: [
{
click: onSelect
}
]
});
root.list = list;

"Listener" attribute breaks execution (Chrome being used)



Uncaught TypeError: Object [object Object] has no method 'toLowerCase'


Ext.util.Observable.Ext.extend.addListenerext-touch-debug.js:598 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
Ext.lib.Component.Ext.extend.addListenerext-touch-debug.js:16010 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
Ext.util.Observable.Ext.extend.constructorext-touch-debug.js:465 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
Ext.lib.Component.Ext.extend.constructorext-touch-debug.js:15482 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
subclassext-touch-debug.js:115 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
starttest.js:58 (http://localhost:8080/bfs-sencha/guide/test.js)
(anonymous function)ext-touch-debug.js:11233 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)
(anonymous function)ext-touch-debug.js:11249 (http://localhost:8080/bfs-sencha/sencha/js/ext-touch-debug.js)

evant
26 Oct 2010, 3:07 PM
Listeners is meant to be an object:



listeners: {
click: onSelect
}