[TIMOB-16482] iOS: Layout does not work when using TableView updateSection
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.2.1 |
Fix Version/s | n/a |
Components | iOS |
Labels | ios |
Reporter | Douglas Turner |
Assignee | Unknown |
Created | 2014-02-14T02:14:10.000+0000 |
Updated | 2018-02-28T20:03:11.000+0000 |
Description
When using tableview.updateSection, row layout:'horizontal' and layout:'vertical' does not work. Layout: 'composite' gives a blank table. The code below lays out sections one and two (figure A) then updates section two (figure B).
var self = Titanium.UI.createWindow({
backgroundColor : 'white'
});
var tableView = Titanium.UI.createTableView({
top : 20
});
var sectiondata = [];
var oneSection = Ti.UI.createTableViewSection();
var one_header_row = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var one_header = Ti.UI.createView({
backgroundColor : 'silver',
height : 30
});
var l_oneHeader = Ti.UI.createLabel({
text : 'One',
font : {
fontSize : 18
},
color : 'white',
height : 30,
left : 10
});
one_header.add(l_oneHeader);
one_header_row.add(one_header);
oneSection.add(one_header_row);
var itemRow_one = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var l_a_one = Titanium.UI.createLabel({
color : 'blue',
text : '1',
height : 40,
left : 10
});
itemRow_one.add(l_a_one);
var l_b_one = Titanium.UI.createLabel({
color : 'green',
text : 'Label',
height : 40,
left : 10
});
itemRow_one.add(l_b_one);
var l_c_one = Titanium.UI.createLabel({
text : 'Description text',
height : 40,
left : 10
});
itemRow_one.add(l_c_one);
oneSection.add(itemRow_one);
sectiondata.push(oneSection);
var twoSection = Ti.UI.createTableViewSection();
var two_header_row = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var two_header = Ti.UI.createView({
backgroundColor : 'silver',
height : 30
});
var l_twoHeader = Ti.UI.createLabel({
text : 'Two',
font : {
fontSize : 18
},
color : 'white',
height : 30,
left : 10
});
two_header.add(l_twoHeader);
two_header_row.add(two_header);
twoSection.add(two_header_row);
var itemRow_two = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var l_a_two = Titanium.UI.createLabel({
color : 'blue',
text : '1',
height : 40,
left : 10
});
itemRow_two.add(l_a_two);
var l_b_two = Titanium.UI.createLabel({
color : 'green',
text : 'Label',
height : 40,
left : 10
});
itemRow_two.add(l_b_two);
var l_c_two = Titanium.UI.createLabel({
text : 'Description text',
height : 40,
left : 10
});
itemRow_two.add(l_c_two);
twoSection.add(itemRow_two);
sectiondata.push(twoSection);
tableView.setData(sectiondata);
/*
* UPDATE THE SECTION WE JUST CREATED
* Use the exact same table info as the first two sections and use updateSection
*/
var updatedSection = Ti.UI.createTableViewSection();
var updated_header_row = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var updated_header = Ti.UI.createView({
backgroundColor : 'silver',
height : 30
});
var l_updatedHeader = Ti.UI.createLabel({
text : 'Two',
font : {
fontSize : 18
},
color : 'white',
height : 30,
left : 10
});
updated_header.add(l_updatedHeader);
updated_header_row.add(updated_header);
updatedSection.add(updated_header_row);
var itemRow_updated = Ti.UI.createTableViewRow({
layout : 'horizontal'
});
var l_a_updated = Titanium.UI.createLabel({
color : 'blue',
text : '1',
height : 40,
left : 10
});
itemRow_updated.add(l_a_updated);
var l_b_updated = Titanium.UI.createLabel({
color : 'green',
text : 'Label',
height : 40,
left : 10
});
itemRow_updated.add(l_b_updated);
var l_c_updated = Titanium.UI.createLabel({
text : 'Description text',
height : 40,
left : 10
});
itemRow_updated.add(l_c_updated);
updatedSection.add(itemRow_updated);
tableView.updateSection(updatedSection, 1);
self.add(tableView);
self.open();
Attachments
File | Date | Size |
---|---|---|
figure A.png | 2014-02-18T21:40:08.000+0000 | 30092 |
figure B.png | 2014-02-18T21:40:08.000+0000 | 29789 |
Please provide a runnable test case to reproduce this issue. I tried to run the provided test but it complains of undefined variables and rightly so.
I have updated to code to provide a runnable test.
Moving this ticket to engineering as I can reproduce this issue with provided test case. It appears that updateSection method does not work correctly with the layouts.