Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19068] Windows: Clicking on Tableview row does not give rowdata value but [object object]

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionWon't Fix
Resolution Date2015-06-26T19:37:11.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sn/a
ComponentsWindows
Labelsqe-4.1.0
ReporterLokesh Choudhary
AssigneeIngo Muschenetz
Created2015-06-25T00:04:58.000+0000
Updated2015-06-29T18:38:45.000+0000

Description

Steps To Reproduce:

1. Use the code below in your app.js:
var win = Ti.UI.createWindow({backgroundColor:'black'});
 
var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
 
var table = Ti.UI.createTableView({
  data: tableData
});
 
table.addEventListener('click', function(e){
    alert(e.rowData);
});
 
win.add(table);
win.open();
2. Build for windows device/emulator. 3. After the app launches click on any row.

Actual Result:

1. The alert shows [object object] rather than row data.

Expected Result:

1. The alert should the row value.

Comments

  1. Kota Iguchi 2015-06-25

    [~lchoudhary], what exactly do you mean by "row value"? Do you expect it returns string like "\{title: 'Bananas'\}"? Currently e.rowData returns JavaScript dictionary object according to [Titanium API doc](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-event-click). So for example when you alert(e.rowData), it should show it is an Object. You can dump its actual value by string when you use JSON.stringify.
       table.addEventListener('click', function (e) {
           alert(JSON.stringify(e.rowData));
       });
       
  2. Lokesh Choudhary 2015-06-25

    [~kota], Ok thanks for clarifying, I get
    object
    . I opened the ticket because on android the same code returns the string like
    title: Bananas
    & I was thinking we should have parity across platforms ?
  3. Kota Iguchi 2015-06-25

    [~lchoudhary], thanks for information. After discussion with Windows team we come up with conclusion that we want it to match with Titanium iOS behavior because Titanium iOS & Windows uses same JavaScript engine (JavaScriptCore). We'll work on that.
  4. Christopher Williams 2015-06-25

    [~kota] [~lchoudhary] Looks to me like this isn't something every platform does the same. I just tried on iOS and got the following:
       [object TiUITableViewRow]
       
  5. Kota Iguchi 2015-06-25

    [~cwilliams] [~lchoudhary] Thanks for clarification. I would say this behavior on Titanium Windows is valid where we are returning "properties of the row" across platform correctly according to Titanium API doc, using different internal representation. You can check actual values by string using JSON.stringify.
  6. Lokesh Choudhary 2015-06-29

    Closing

JSON Source