[TIMOB-16079] Android: Incorrect e.itemIndex for ListView and SearchBar
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-08-20T00:58:36.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | Release 3.4.0 |
Components | Android |
Labels | module_listview, qe-manualtest |
Reporter | Tim Fisher |
Assignee | Sunila |
Created | 2013-12-18T08:58:25.000+0000 |
Updated | 2014-08-22T16:04:37.000+0000 |
Description
Steps to Reproduce
Create a SearchBar and ListView in Alloy, populate with searchable data. Enter search query in SearchBar and click top item. iOS returns the correct index of the clicked item, Android will return an index that is relative to the filtered list. i.e. the top item will always have an itemIndex of 0 on Android.
Actual Result
0
Expected Result
other than 0
Attachments
Thank you, Tim, for reporting this issue. I would appreciate if you can provide a simple test case to reproduce the issue as that would help us in troubleshoot the issue.
Here is an example that returns the correct item on iOS and shows the issue on Android.
Any idea when this will be fixed? I have an app going live at the end of Feb and this needs to be in.
Hi guys, I have an app need to release at the end of this March. Can you guys fix it earlier? Or can explain me the reason of this issue and I can play around with it. Thanks so much
Hi All, Same issue here, is there any workaround available? Thank you very much!
I did some trick and it working for me, I tested and found" e.sectionIndex is right. e.itemIndex(wrong) is index of item in results list not original list. So we can use _.filter() to get results manually from original list and SearchText(_results) and item we need will be _results[e.itemIndex]. Code:
Deferring to 3.4.0 to properly fix parity issue. Please let us know if the workaround does not work for you.
Can I please champion this parity bug to be fixed as the work around is a lot of extra code. For anyone not searching but filtering something like this will help:
Modfied the code to store real index instead of the filtered index in the event data https://github.com/appcelerator/titanium_mobile/pull/5755
Verified the fix. Android returns the right e.itemIndex & not just of the first item. Closing. Environment: Appc Studio : 3.4.0.201408180158 Ti SDK : 3.4.0.v20140815142514 Mac OSX : 10.8.5 Alloy : 1.5.0-dev CLI - 3.4.0-dev Code Processor: 1.1.1 Nexus 5 - android 4.4.4
Due for release in 3.4.0. REALLY!!!? This is quite a critical bug and I would ask for it to be part of a maintainance release please
Oh, okay. I saw the PR was 3 months old and having just released 3.3.0.GA I thought 3.4.0 was going to be a while off.