[ALOY-1033] ListView searchView property throws error if set in XML
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-09-12T13:47:32.000+0000 |
Affected Version/s | Alloy 1.4.0, Alloy 1.3.1 |
Fix Version/s | Alloy 1.5.0 |
Components | XML |
Labels | n/a |
Reporter | Tim Poulsen |
Assignee | Tim Poulsen |
Created | 2014-05-28T18:21:12.000+0000 |
Updated | 2014-09-15T08:58:44.000+0000 |
Description
One option for enabling list view searching is to set the
searchView
property of the list equal to a reference to the SearchBar component.
*Expectation*
I should be able to set this property as an attribute of the <ListView>
tag in the XML.
*Actual*
As demonstrated by the attached app, doing so throws this error:
[ERROR] Script Error {
[ERROR] backtrace = "#0 () at file:///Users/tpoulsen/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/D10A7127-56CA-485E-99C7-FE9A5C9DDD60/ListViewSearch.app/alloy.js:231";
[ERROR] line = 95;
[ERROR] message = "Invalid type passed to function";
[ERROR] nativeLocation = "-[TiUIListView setSearchView_:] (TiUIListView.m:746)";
[ERROR] nativeReason = "expected: TiUISearchBarProxy or nil, was: String";
[ERROR] sourceId = 259295456;
[ERROR] sourceURL = "file:///Users/tpoulsen/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/D10A7127-56CA-485E-99C7-FE9A5C9DDD60/ListViewSearch.app/alloy/controllers/index.js";
[ERROR] }
*Reason and workaround*
The attribute's value is being passed as a string to the ListView component, rather than as a reference to the component with that ID. As a workaround, you can set the searchView property in the controller.
Attachments
File | Date | Size |
---|---|---|
ListViewSearch.zip | 2014-05-28T18:21:12.000+0000 | 5906989 |
PR: https://github.com/appcelerator/alloy/pull/422 Test app: test/apps/testing/ALOY-1033 Functional test: 1. Run the app (should see no errors in console or app). Tap in the search box and search for items (should work). 2. Edit the app's index.xml to move the
Tested Tim's PR, functional tests passed.
PR merged
This is an SDK issue, not Alloy.
Crashes in the same way.
Master: https://github.com/appcelerator/alloy/pull/554 1_5_X: https://github.com/appcelerator/alloy/pull/555 Update the test app to reflect the platform differences, such that the SearchBar is outside the list for iOS and inside the list for Android.
PRs tested and merged
Verified in the following environment : Appcelerator Studio, build: 3.4.0.201409131030 CLI: 3.4.0-rc3 Alloy: 1.5.0-rc2 Code processor: 1.1.1 SDK: 3.4.0.v20140913174915 Mac OSX version 10.9.4 Xcode: Xcode 6 GM seed Windows 8.1 Device: ipad (ios8) and samsung galaxy (4.4.2)