Results 1 to 3 of 3

Thread: Store can't handle data where a number preceeds the number 0 in the id property

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    22
    Vote Rating
    1
      0  

    Exclamation Store can't handle data where a number preceeds the number 0 in the id property

    Sencha Touch version tested:
    • 1.1.0


    • only default sencha-touch.css

    Platform tested against:
    • Safari 5.1 (Windows 7 32bit)
    • Android 2.2

    Description:
    • Store can't handle data where a number preceeds the number 0 in the id property, eg. -1, 0, 1 or 2, 0, 1. The internalid of the record with id 0 is set to 'Ext-record-X' where X is a number. If the id starts from 0 there is no problem.
    • The problem is the same when loading data from AJAX.

    Test Case:
    Code:
     <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">   
        <title>Select fails on zero</title>
        <link rel="stylesheet" href="http://dev.sencha.com/deploy/touch/resources/css/sencha-touch.css" type="text/css">
        <script type="text/javascript" src="http://dev.sencha.com/deploy/touch/sencha-touch.js"></script>
        <script type="text/javascript">
            Ext.setup({
                icon: 'http://dev.sencha.com/deploy/touch/examples/sortable/icon.png',
                glossOnIcon: false,
                tabletStartupScreen: 'http://dev.sencha.com/deploy/touch/examples/sortable/tablet_startup.png',
                phoneStartupScreen: 'http://dev.sencha.com/deploy/touch/examples/sortable/phone_startup.png',
                onReady: function () {
                    Ext.regModel('User', {
                        fields: [
                            { name: 'id', type: 'int' },
                            { name: 'name', type: 'string' },
                            { name: 'phone', type: 'string', mapping: 'phoneNumber' }
                        ]
                    });
    
                    var data = {
                        users: [
                            {
                                id: -1,
                                name: 'Jamie Avins',
                                phoneNumber: '-11 1234'
                            },
                            {
                                id: 0,
                                name: 'Tommy Maintz',
                                phoneNumber: '000 1234'
                            },
                            {
                                id: 1,
                                name: 'Ed Spencer',
                                phoneNumber: '111 1234'
                            },
                            {
                                id: 2,
                                name: 'Abe Elias',
                                phoneNumber: '222 1234'
                            }
                        ]
                    };
    
                    var store = new Ext.data.Store({
                        autoLoad: true,
                        model: 'User',
                        data: data,
                        proxy: {
                            type: 'memory',
                            reader: {
                                type: 'json',
                                root: 'users'
                            }
                        }
                    });
    
                    var txt = new Ext.form.TextField({ value: 'Sencha version: ' + Ext.version });
    
                    var select = new Ext.form.Select({
                        itemId: 'id_form_sel',
                        name: 'sel',
                        label: 'Selskab',
                        valueField: 'id',
                        displayField: 'name',
                        scope: this,
                        store: store,
                        listeners: {
                            scope: this,
                            'change': function (select, value) {
                                txt.setValue('Selected value: ' + value);
                            }
                        }
                    });
    
                    new Ext.Application({
                        launch: function () {
                            new Ext.Panel({
                                fullscreen: true,
                                items: [select, txt]
                            });
                        }
                    });
                }
            });
        </script>
    </head>
    
    <body>
    </body>
    </html>
    Steps to reproduce the problem:
    • Select the second item in the select cmp ("Tommy Maintz" id: 0).

    The result that was expected:
    • Select cmp should select the item with id: 0
    • The value parameter of the change event should be 0

    The result that occurs instead:
    • Select cmp selects the item with id: -1
    • The value parameter of the change event is -1 in Safari, 0 on Android 2.2

    Debugging already done:
    • console.log(store) shows that store.data.keys[1] is "ext-record-1" instead of 0.

    Possible fix:

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    22
    Vote Rating
    1
      0  

    Default Bump

    Bump

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    22
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by Nikkelmann View Post
    Bump
    Bump...

Posting Permissions

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