Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25843] Android: Fix TableView handleSetData() #9916

Merged
merged 4 commits into from Mar 8, 2018

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Mar 7, 2018

  • Fix updating of TableView UI after setting data
NOTE: no tests as this is a UI issue, the TableView section does get populated. This change just isn't visible to the user.
TEST CASE #1
var win = Ti.UI.createWindow({ backgroundColor: 'gray' }),
    data = [
        Ti.UI.createTableViewSection({ headerTitle: 'SECTION #1' }),
        Ti.UI.createTableViewSection({ headerTitle: 'SECTION #2' }),
        Ti.UI.createTableViewSection({ headerTitle: 'SECTION #3'})
    ],
    tv = Ti.UI.createTableView({ separatorStyle: Ti.UI.TABLE_VIEW_SEPARATOR_STYLE_NONE });

// section #1 data
data[0].add(Ti.UI.createTableViewRow({ title: 'Square' }));
data[0].add(Ti.UI.createTableViewRow({ title: 'Circle' }));
data[0].add(Ti.UI.createTableViewRow({ title: 'Triangle' }));

// section #2 data
data[1].add(Ti.UI.createTableViewRow({ title: 'Square' }));
data[1].add(Ti.UI.createTableViewRow({ title: 'Circle' }));
data[1].add(Ti.UI.createTableViewRow({ title: 'Triangle' }));

// set table data
tv.data = data;

win.addEventListener('open', function (e) {

    // section #3 data
    data[2].add(Ti.UI.createTableViewRow({ title: 'Square' }));
    data[2].add(Ti.UI.createTableViewRow({ title: 'Circle' }));
    data[2].add(Ti.UI.createTableViewRow({ title: 'Triangle' }));

    // set table data
    tv.data = data;
});

win.add(tv);
win.open();
  • All three sections should be populated
TEST CASE #2
var win = Ti.UI.createWindow({ backgroundColor: 'gray' }),
    data = [],
    tv = Ti.UI.createTableView();

// create rows
for (let i = 1; i <= 32; i++) {
    data.push(Ti.UI.createTableViewRow({ title: 'ITEM #' + i }));
}

// set table data
tv.data = data;

// remove a row after 5s
setTimeout(function () {
    data.pop();
    tv.data = data;
}, 5000);

win.add(tv);
win.open();
  • Last row will be removed after five seconds, should not cause crash upon scrolling to last row

JIRA Ticket

@build
Copy link
Contributor

build commented Mar 7, 2018

Messages
📖

👍 Hey!, You deleted more code than you added. That's awesome!

📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@lokeshchdhry
Copy link
Contributor

FR Passed.

Set data works as expected. Data is successfully set when we use tv.data = data;.

Studio Ver: 5.0.0.201712081732
SDK Ver: 7.2.0 local build
OS Ver: 10.13.2
Xcode Ver: Xcode 9.2
Appc NPM: 4.2.12
Appc CLI: 7.0.2
Daemon Ver: 1.0.1
Ti CLI Ver: 5.0.14
Alloy Ver: 1.11.0
Node Ver: 8.9.1
NPM Ver: 5.5.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Nexus 6P --- Android 8.0.0

@lokeshchdhry lokeshchdhry merged commit 640c95b into tidev:master Mar 8, 2018
@sgtcoolguy sgtcoolguy modified the milestones: 7.2.0, 7.3.0 May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants