[TIMOB-11900] Android, iOS: Titanium.UI.TableViewRow.hasCheck and getHasCheck() return as number String, not Boolean
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android, iOS |
Labels | n/a |
Reporter | Christina Hustedde |
Assignee | Unknown |
Created | 2012-11-07T13:53:09.000+0000 |
Updated | 2018-02-28T20:03:32.000+0000 |
Description
In the [documentation for Titanium.UI.TableViewRow](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableViewRow), hasCheck and getHasCheck() are listed as Boolean values, but hasCheck evaluates as a String and getHasCheck() returns a String. In Android, they are the strings 'true' and 'false' and in iOS, they are the strings '1' and '0'. Since none of these are empty strings, they are all 'truthy' in Javascript. Please also see the discussion [here](http://developer.appcelerator.com/question/144387/hascheck-works-on-ios-but-not-android).
This is not really a doc issue. We should be returning a boolean, and we're not. The substance of this bug is not entirely correct, either. It appears that in both cases, simply store the value passed in and don't try to coerce it to a boolean. If you pass in a boolean, it returns a boolean. If you pass in a string, it returns a string. Note that I can't reproduce the original issue: if I pass in a number, I'm getting a number back. In both cases, the platform should probably be coerce the value to boolean when it returns. Also note: 1) This applies to both iOS and Android. 2) I believe this applies to the other boolean properties on TableViewRow, as well (such as hasChild and hasDetail). 3) It undoubtedly affects other objects, as well, since we use this technique of dropping values into a properties dictionary in many places.