[TIMOB-14846] Android: ListView sectionCount bug
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2015-04-21T23:01:28.000+0000 |
Affected Version/s | Release 3.1.1, Release 3.1.2 |
Fix Version/s | n/a |
Components | Android |
Labels | alloy, listview, parity |
Reporter | Mark Mokryn |
Assignee | Hieu Pham |
Created | 2013-08-10T08:37:11.000+0000 |
Updated | 2017-03-30T21:19:33.000+0000 |
Description
*Problem*
In a tabbed application on Android, the ListView sectionCount property is 0 before the tab containing the ListView is in view. This bug bit me when I initialized the ListView upon opening the TabGroup, and later tried to update it prior to the user actually viewing the tab. Interesting to note that the number of items in the ListView is correct - but sectionCount is wrong. It works on iOS.
*index.xml*
<Alloy>
<TabGroup>
<Tab title="Tab 1" icon="KS_nav_ui.png">
<Window title="Tab 1" backgroundColor="#FFF">
<Label onClick="doClick">Click me before viewing tab 2</Label>
</Window>
</Tab>
<Tab title="Tab 2" icon="KS_nav_views.png">
<Window title="Tab 2" backgroundColor="#FFF">
<Label top="10dp">I am Window 2</Label>
<ListView id="lv" top="50dp">
<ListSection>
<ListItem title="row 1"/>
<ListItem title="row 2"/>
<ListItem title="row 3"/>
<ListItem title="row 4"/>
<ListItem title="row 5"/>
<ListItem title="row 6"/>
<ListItem title="row 7"/>
<ListItem title="row 8"/>
<ListItem title="row 9"/>
<ListItem title="row 10"/>
</ListSection>
</ListView>
</Window>
</Tab>
</TabGroup>
</Alloy>
*index.js*
function doClick() {
alert('section count should be 1, actual value is: ' + $.lv.sectionCount + '. Note however that the number of items is correct: ' + $.lv.sections[0].items.length);
}
$.index.open();
Tested and confirmed on Samsung Galaxy S2 Android 2.3.6 with Ti SDK 3.1.1 GA.
I encountered the same bug in classic project SDK 3.3.0.GA.
I can't reproduce this on master. Works fine for me
Closing ticket as I am unable to reproduce the issue using the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80