-
7 Feb 2013 12:18 PM #1
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)
- Chrome 24.0.1312.57
- Safari iOS 6
- 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.
- Create an element with the sample I appended below.
- The values in the data properties should not be modified by the framework
- Values considered "false" are being converted to empty Objects ({})
Possible fix: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 } ] }, (...)- 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.
-
7 Feb 2013 1:09 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
Thanks for the report! I have opened a bug in our bug tracker.
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.


Reply With Quote