Results 1 to 6 of 6

Thread: Calling 'deselect' on a list results in an error

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1074 in a recent build.
  1. #1
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159

    Default Calling 'deselect' on a list results in an error

    Even after fixing the bug causing the error, deselect still doesn't work.

    Here's the error:

    Code:
    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:
    Code:
    records = [me.store.getAt(records)];
    to this:
    Code:
    records = [me.getStore().getAt(records)];
    seems to cause the error to go away, but the deselection still does not occur.
    Twitter: lylepratt

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    Can you provide more details as to the code used which caused the error so we can reproduce it?

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159

    Default

    My apologies for not providing more information originally. I'll mock up an example when I get back to a computer.
    Twitter: lylepratt

  4. #4
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159

    Default

    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:

    Code:
    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);
            });
        }
    });
    Twitter: lylepratt

  5. #5
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    Fair enough, I'll check into it.

    Sencha Inc

    Jamie Avins

    @jamieavins

  6. #6
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    This issues has been fixed for the next release.

    Sencha Inc

    Jamie Avins

    @jamieavins

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •