PDA

View Full Version : [FIXED] Calling 'deselect' on a list results in an error



lylepratt
19 Nov 2011, 8:45 PM
Even after fixing the bug causing the error, deselect still doesn't work.

Here's the error:



Error

line: 20658
message: "'undefined' is not an object (evaluating 'me.store.getAt')"
sourceId: 4459808320
sourceURL: "http://dev.lylepratt.com/app/load/core/sencha-touch-all-debug-w-comments.js"
__proto__: Error


Changing line 20658 in sencha-touch-all-debug-w-comments.js from this:


records = [me.store.getAt(records)];


to this:


records = [me.getStore().getAt(records)];


seems to cause the error to go away, but the deselection still does not occur.

Jamie Avins
21 Nov 2011, 9:17 AM
Can you provide more details as to the code used which caused the error so we can reproduce it?

lylepratt
21 Nov 2011, 9:21 AM
My apologies for not providing more information originally. I'll mock up an example when I get back to a computer.

lylepratt
21 Nov 2011, 10:25 AM
Hmm. Well. I'm having trouble reproducing the Error I mentioned above, but deselect() still seems to have issues when passing a list index. I guess I was doing something wrong at the time to produce the error.

deselect() isn't working when you pass the list index. It DOES work when you pass a store record. The documentation states that you can pass the list index.

Here is some code as an example:



Ext.application({
name: 'app',
controllers: [],
launch: function() {
console.log('app launch');


Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});


var store = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',


getGroupString: function(record) {
return record.get('lastName')[0];
},


data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Jacky', lastName: 'Nguyen'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'},
{firstName: 'Nigel', lastName: 'White'},
{firstName: 'Don', lastName: 'Griffin'},
{firstName: 'Nico', lastName: 'Ferrero'},
{firstName: 'Nicolas', lastName: 'Belmonte'},
{firstName: 'Jason', lastName: 'Johnston'}
]
});


var list = new Ext.List({
fullscreen: true,
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
store: store
});


list.on('itemtap', function(list, index) {
setTimeout(function() {
list.deselect(index);
console.log('Passing a list index does NOT work and also does not produce an error: '+index)
}, 1000);


setTimeout(function() {
var record = store.getAt(index);
list.deselect(record);
console.log('But passing a record seems to work fine: '+index)
}, 3000);
});
}
});

Jamie Avins
21 Nov 2011, 11:16 AM
Fair enough, I'll check into it.

Jamie Avins
21 Nov 2011, 2:31 PM
This issues has been fixed for the next release.