Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16359] iOS:ListView scrollToItem does not scroll item to the top if visible already

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0, Release 3.2.1
Fix Version/sn/a
ComponentsiOS
LabelsengSchedule, supportTeam
ReporterRupesh Sharma
AssigneeAbir Mukherjee
Created2014-02-03T12:23:50.000+0000
Updated2020-11-23T17:53:28.000+0000

Description

Description

In the ListView having approx 60 rows, "scrollToItem" method is not repositioning the selected index item (row) to the top of the view. If, the row is part of the currently visible rows. so for example if i want to programatically move row index 5, up, to the position of row 0, via:
$.listview.scrollToItem(0,5);
the ListView row's do not move at all. however i would expect row 5, to reposition itself to become effectively row "0" (ie. top of the ListView) but this does not occur.

Test Case

index.xml
<Alloy>
    <Window fullscreen="true">
        <ListView id="listview">
         
            <HeaderView>
                <View backgroundColor="#DDD" height="Ti.UI.SIZE">
                    <Button id="button" onClick="doClick" title="CLICK"
            top="10" width="100" height="50" />
                </View>>
            </HeaderView>
            <ListSection>
                <ListItem title="Papaya" searchableText="Papaya"/>
                <ListItem title="Peach" searchableText="Peach"/>
                <ListItem title="Pear" searchableText="Pear"/>
                <!-- ADD MORE ROWS -->
            </ListSection>

        </ListView>
    </Window>
</Alloy>
index.js
function doClick(e) {
    Ti.API.info('clicked');
    $.listview.scrollToItem(0,5);
}

$.index.open();

Comments

No comments

JSON Source