[TIMOB-18411] iOS: A ListView's SearchBar doesn't filter when programmatically set
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-01-05T08:59:26.000+0000 |
Affected Version/s | Release 3.5.0 |
Fix Version/s | Release 5.4.0 |
Components | iOS |
Labels | ListView, SearchBar, qe-5.4.0 |
Reporter | Fokke Zandbergen |
Assignee | Srikanth Sombhatla |
Created | 2015-01-19T19:12:10.000+0000 |
Updated | 2016-06-15T19:00:56.000+0000 |
Description
Programmatically setting a SearchBar's value doesn't filter the ListView's rows where it is attached to, unless you focus/blur it. The value does show.
Expected behaviour
Setting the SearchBar value, either on creation or thereafter should filter the ListView (or TableView) it is attached to.Steps to reproduce
1. Build an app with the following code 2. Confirm that both line 6 and 30 properly set the value but doesn't filter 3. Confirm that line 29 en 31 provide a workaroundCode to reproduce
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var searchView = Ti.UI.createSearchBar({
value: 'Row 10'
});
var listView = Ti.UI.createListView({
top: 20,
searchView: searchView,
sections: [Ti.UI.createListSection({
items: (function() {
var items = [];
for (var i = 1; i < 30; i++) {
items.push({
properties: {
title: 'Row ' + i,
searchableText: 'Row ' + i
}
});
}
return items;
})()
})]
});
win.addEventListener('open', function() {
// searchView.focus();
searchView.value = 'Row 10';
// searchView.blur();
});
win.add(listView);
win.open();
I just get an project where I really could need this. The workaround does what it should. But it's ot very nice
PR https://github.com/appcelerator/titanium_mobile/pull/7609
PR approved!
Verified as fixed. Tested on: iPhone 6s Plus (9.3.1) iOS Simulator (9.3) Mac OSX El Capitan 10.11.4 Studio: 4.7.0.201606150733 Ti SDK: 5.4.0.v20160608165242 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-15 Xcode 7.3.1 Node v0.12.7 * Closing Ticket.*