1. #1
    Touch Premium Member
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    mmarchesi@xtel.it is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    434
    Answers
    3105
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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