[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 thesearchView
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 |