Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24134] Windows: tableview.data/getData does not return a tableviewsection

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-02-06T08:00:21.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.1.0
ComponentsWindows
Labelsparity, qe-6.0.0
ReporterEwan Harris
AssigneeKota Iguchi
Created2016-11-10T17:36:03.000+0000
Updated2017-02-09T22:37:11.000+0000

Description

Description

When calling tableview.data/tableView.getData() on Windows it will return tableviewrows however on both iOS and Android it will always seem to return a tableviewsection regardless of if a tableviewsection has been added.
var _window = Ti.UI.createWindow();
var table = Ti.UI.createTableView({
    top: 0,
    bottom: 0
});

var tableData = [];

for (var i = 0; i < 10; i++) {
    tableData.push(Ti.UI.createTableViewRow({
        title: "Row " + (i + 1)
    }));
}

table.setData(tableData);

_window.add(table);

table.addEventListener("click", function (e) {
    alert(table.data[0].rows[e.index].title);
});
_window.open();
I'm unsure which is the preferential behaviour

Steps to reproduce

Add the above code to an existing app.js and build for windows platform

Click update row

Observe logs

Actual result

The value returned is multiple tableviewrows

Expected result

Unsure, but for parity with other platforms it should be a tableviewsection

Attachments

FileDateSize
6.1.0.v20170209111025 1.PNG2017-02-09T22:33:52.000+000011450
Screen Shot 2017-02-07 at 1.31.42 PM.png2017-02-07T21:32:15.000+000099108

Comments

  1. Kota Iguchi 2017-01-31

    As far as I can see from the source, data always returns TableViewSection[] on [iOS](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUITableViewProxy.m#L782) and [Android](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewProxy.java#L697). The reason why type of Ti.UI.TableView.data is marked both Titanium.UI.TableViewRow[]/Titanium.UI.TableViewSection[] in [API doc](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-property-data) I think is that it _accepts_ Titanium.UI.TableViewRow[] as well as Titanium.UI.TableViewSection[] whereas data always _returns_ Titanium.UI.TableViewSection[]. So Windows implementation was wrong in this case.
  2. Gary Mathews 2017-02-01

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/940
  3. Samir Mohammed 2017-02-07

    [~kota] with the code provided in the description and with the code in https://github.com/appcelerator/titanium_mobile_windows/pull/940 I get the following error message on the windows mobile. !Screen Shot 2017-02-07 at 1.31.42 PM.png|thumbnail! *Environment*
       Phone : Lumia 640 LTE (RM-1073)
       Operating System:
       Name                        = Microsoft Windows 10 Pro
       Version                     = 10.0.14393
       Architecture                = 32bit
       

    CPUs = 4

    Memory = 17034395648 Node.js: Node.js Version = 4.6.0 npm Version = 2.15.9 Titanium SDK: SDK Version = 6.1.0.v20170206114448
  4. Samir Mohammed 2017-02-09

    Verified fix with the test code provided in the description. Was able to see an alert with the row number which had been clicked. !6.1.0.v20170209111025 1.PNG|thumbnail! *Environment*
       Phone : Lumia 640 LTE (RM-1073)
       Operating System:
       Name                        = Microsoft Windows 10 Pro
       Version                     = 10.0.14393
       Architecture                = 32bit
       

    CPUs = 4

    Memory = 17034395648 Node.js: Node.js Version = 4.6.0 npm Version = 2.15.9 Titanium SDK: SDK Version = 6.1.0.v20170209111025

JSON Source