Results 1 to 2 of 2

Thread: Scroll problem in list with grouping after data change

  1. #1
    Touch Premium Member
    Join Date
    Oct 2011
    Posts
    7
    Vote Rating
    0
      0  

    Default Unanswered: Scroll problem in list with grouping after data change

    There seems to be an issue with the scrolling in a list with active grouping after data from the data store is changed.

    The first time the list is rendered everything works fine, but after I change the data in the list's store , the scrolling does not work no more and has a strange behavior. The scroll bar seems to scroll but the content is not moving.

    In sencha touch script file this uncaught error pops up:
    class: Ext.dataview.List
    function: translateHeaderTransform: function (offset)
    error: Uncaught TypeError: Cannot read property 'style' of undefined

    Here is a simple code example that reproduces the bug:

    Code:
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript" src="sencha-touch-all-debug-w-comments.js"></script>
        <link href="resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
            Ext.application({
                name: 'app',
                launch: function () {
                    var self = this;
    
    
    
    
                    //create viewport
                    this.viewport = Ext.create('Ext.Panel', {
                        fullscreen: true,
                        layout: { type: 'card' }
                    });
    
    
                    //define data model
                    Ext.define("demoModel", { extend: "Ext.data.Model", fields: ["value"] });
    
    
                    //define store
                    this.store = Ext.create('Ext.data.Store', {
                        model: 'demoModel'
                    });
    
    
                    //create sample data
                    var data = [];
                    for (var i = 100; i < 200; i++) {
                        data.push({ value: i });
                    }
    
    
                    //load data into store
                    this.store.loadData(data, false);
    
    
                    //Setup grouping
                    this.store.getGroupString = function (record) {
                        return record.data.value.toString().substring(0, 2)
                    }
    
    
                    //create list
                    this.list = Ext.create('Ext.List', {
                        store: this.store,
                        scrollable: 'vertical',
                        grouped: true,
                        itemTpl: '<div>{value}</div>'
                    });
    
    
                    //create top toolbar
                    this.topToolbar = Ext.create('Ext.Toolbar', {
                        docked: 'top',
                        items: [
                        {
                            xtype: 'button',
                            text: 'change data',
                            handler: function () {
    
    
                                //create sample data
                                var data = [];
                                for (var i = 200; i < 300; i++) {
                                    data.push({ value: i });
                                }
                                //load data into store
                                self.store.loadData(data, false);
                            }
                        }]
                    });
    
    
                    this.viewport.add(this.list);
                    this.viewport.add(this.topToolbar);
                    this.viewport.show();
                }
            });
    
    
        </script>
    </head>
    <body>
    </body>
    </html>
    The problem reproduces on Google Chrome, Android tablet and IPhone.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    Just tested on Chrome using our latest code that will be apart of PR3 when it makes it out and the scrolling is working after I press the change data button.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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