You found a bug! We've classified it as TOUCH-3980 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default Serious Bug in how "data" properties are being handled in ST 2.1

    Serious Bug in how "data" properties are being handled in ST 2.1


    Sencha Touch version tested:
    • Sencha Touch 2.1 - Build date: 2012-11-05 22:31:29 (08c91901ae8449841ff23e5d3fb404d6128d3b0b)
    Browser versions tested against:
    • Chrome 24.0.1312.57
    • Safari iOS 6
    Description:
    • Our application was created with Sencha Touch 2.0.1, and is in production already. In multiple parts, I used the "data" property of the objects to store information I needed for later retrieval, in some cases that information is a number or a boolean. After updating our application to use Sencha Touch 2.1, I discovered, to my surprise, that the framework now replaces the data properties that are considered [false] with an empty object. This silent change broke several parts of our application, and I really don't see why Sencha would try to parse my "data" values anyhow, since it's supposed to store values chosen by the developer.
    Steps to reproduce the problem:
    • Create an element with the sample I appended below.
    The result that was expected:
    • The values in the data properties should not be modified by the framework
    The result that occurs instead:
    • Values considered "false" are being converted to empty Objects ({})
    Test Case:
    Code:
    (...)
        {
            xtype: 'segmentedbutton',
            allowDepress: false,
            items: [
                {
                    text: 'Option 1',
                    data: 0, // this will become an empty Object ({})
                    pressed: true,
                    flex: 1
                },
                {
                    data: 1,
                    text: 'Option 2',
                    flex: 1
                }
            ]
        },
    (...)
    
    
    
    
    (...)
        {
            xtype: 'segmentedbutton',
            allowDepress: false,
            items: [
                {
                    text: 'Option 1',
                    data: true,
                    pressed: true,
                    flex: 1
                },
                {
                    data: false, // this will become an empty Object ({})
                    text: 'Option 2',
                    flex: 1
                }
            ]
        },
    (...)
    Possible fix:
    • Somewhere in the framework probably there's a code piece like "if (!data) data = {}", and this should not exist. If it HAS to exist somehow for the framework to work, create another private property, don't use a property publicly available to the developers and change its value silently without letting us know about it.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,640
    Vote Rating
    435
    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


    Thanks for the report! I have opened a bug in our bug tracker.

Tags for this Thread