Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16800] TiAPI: TableView - e.rowData returns different results on each platform

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2017-08-21T14:47:32.000+0000
Affected Version/sRelease 3.2.3
Fix Version/sRelease 6.2.0
ComponentsAndroid, iOS, TiAPI
Labelsparity, qe-3.2.3
ReporterPriya Agarwal
AssigneeHans Knöchel
Created2014-04-03T11:48:23.000+0000
Updated2017-08-24T01:44:59.000+0000

Description

Not a regression since issue occurs on 3.2.2.GA,3.2.1.GA and 3.2.0.GA also. e.rowData returns different data on different platform Steps to reproduce: 1.copy paste the code given below in app.js 2.Launch the app and click on Row.
var win = Ti.UI.createWindow({
   });
  var data=[];
   var table = Ti.UI.createTableView({
        top:0,
        height: "66%"
   }); 
   var row = Ti.UI.createTableViewRow({
        width: Ti.UI.FILL,
        backgroundColor:"red",
        height: 64
   });  
data.push(row);
table.addEventListener("click", function (e) { 
    Ti.API.warn("clicked: " + JSON.stringify(e.rowData));
});
table.data = data; 
win.add(table);
win.open();
Expected Result: Both platform must show the same result. Actual Result: Both the platform gives different result. On Android getting the output as:
[WARN] :   clicked: {"enabled":true,"height":64,"visible":true,"backgroundColor":"red","backgroundRepeat":false,"width":"fill"}
On iOS getting the output as:
[WARN]:clicked{"width":"FILL","backgroundColor":"red","horizontalWrap":true,"height":64}

Comments

  1. Ingo Muschenetz 2014-04-03

    Hieu, thoughts on why this is?
  2. Hans Knöchel 2016-10-18

    I guess we want the Android behavior in iOS since it has more information? That would mean that we (just) need to expose some missing properties.
  3. Hans Knöchel 2016-10-19

    PR: https://github.com/appcelerator/titanium_mobile/pull/8526 Test-case:
       var win = Ti.UI.createWindow({});
       var data = [];
       var table = Ti.UI.createTableView({
           top: 0,
           height: "66%"
       });
       var row = Ti.UI.createTableViewRow({
           width: Ti.UI.FILL,
           enabled: false,
           backgroundRepeat: false,
           backgroundColor: "red",
           height: 64
       });
       data.push(row);
       table.addEventListener("click", function(e) {
           Ti.API.warn("clicked: " + JSON.stringify(e.rowData));
       });
       table.data = data;
       win.add(table);
       win.open();
       
  4. Abir Mukherjee 2017-01-03

    Tested with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.1.0.v20170103080657 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2 iOS Device: 10.0 Android Device: 6.0.1 I tested this with SDK 6.1.0, but found that the outputs still differ between iOS and Android. For example, iOS shows the horizontalWrap property while Android does not. Also, Android shows touchEnabled property, while iOS does not. I needed to "enable" createTableViewRow, otherwise the row is not clickable in Android. For iOS it did not matter. See below for actual outputs: iOS:
       [WARN] :   clicked: {"horizontalWrap":true,"visible":true,"enabled":false,"backgroundColor":"red","width":"FILL","height":64,"backgroundRepeat":false}
       
    Android:
       [WARN] :   clicked: {"backgroundColor":"red","width":"fill","height":64,"visible":true,"enabled":true,"hiddenBehavior":4,"backgroundRepeat":false,"touchEnabled":true}
       
  5. Hans Knöchel 2017-01-08

    [~amukherjee] You are correct, here are the comparisons: ||Property||iOS||Android|| |horizontalWrap|x| | |visible|x|x| |enabled|x|(Wrong value)| |backgroundColor|x|x| |width|x|x| |height|x|x| |touchEnabled| |x| |hiddenBehavior| |x| Notes: hiddenBehavior is Android-only, so it's not intended to be included on iOS. I fixed the touchEnabled one in [this commit](https://github.com/appcelerator/titanium_mobile/commit/aadb6b0d4475dc886b1c93c1febd68833affeb3a) and what we could do is add horizontalWrap to the Android defaults and see why enabled returns false on Android although (manually) specified as true. [~gmathews] Can you maybe help me with the latter one?
  6. Michael Gangolf 2017-08-18

    Added horizontalWrap. PR for Android: https://github.com/appcelerator/titanium_mobile/pull/9334 https://github.com/appcelerator/titanium_mobile/pull/9335 Output:
       {"soundEffectsEnabled":true,"backgroundColor":"red","horizontalWrap":true,"visible":true,"height":64,"width":"fill","enabled":true,"hiddenBehavior":4,"backgroundRepeat":false,"touchEnabled":false}
       
    enabled is true in my test
  7. Lokesh Choudhary 2017-08-24

    Verified the fix with SDK 6.2.0.v20170823150226 & 7.0.0.v20170823165814. Closing. Below are the rowData outputs: *SDK 6.2.0.v20170823150226* Android:
       {"soundEffectsEnabled":true,"backgroundColor":"red","horizontalWrap":true,"height":64,"width":"fill","visible":true,"enabled":true,"hiddenBehavior":4,"backgroundRepeat":false,"touchEnabled":true}
       
    IOS:
       {"horizontalWrap":true,"visible":true,"touchEnabled":true,"width":"FILL","backgroundColor":"red","height":64,"enabled":true,"backgroundRepeat":false}
       
    *SDK 7.0.0.v20170823165814* Android:
       {"soundEffectsEnabled":true,"backgroundColor":"red","horizontalWrap":true,"height":64,"width":"fill","visible":true,"enabled":true,"hiddenBehavior":4,"backgroundRepeat":false,"touchEnabled":true}
       
    IOS:
       {"horizontalWrap":true,"visible":true,"touchEnabled":true,"width":"FILL","backgroundColor":"red","height":64,"enabled":true,"backgroundRepeat":false}
       
    Studio Ver: 4.9.1.201707200100 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.3 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.13 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1

JSON Source