Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19161] iOS: Sections not honored while searchBar focused

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
LabelsTCSupportTriage, ios, listitem, listview, searchbar
ReporterHans Knöchel
AssigneeUnknown
Created2015-02-03T21:26:58.000+0000
Updated2018-02-28T19:55:22.000+0000

Description

Hey there, i recently discovered an issue regarding the ListView behavior while focusing the SearchBar. The workaround is a ListView with a custom section-headerView in it. When focusing the search and type a keyword, which is related by the "searchableText" attribute in the ListItem, the item is found properly, but the related section is not shown (although the "keepSectionsInSearch" attribute is set to true). Expected result: - show section headers - accept custom ListView-styles (backgroundColor, separatorStyle, ..) Given result: - sections headers do not appear - custom ListView styles are not honored This is an iOS-specific bug, android works well. Code example:
var win = Ti.UI.createWindow({backgroundColor: 'white', fullscreen: true});
var search = Titanium.UI.createSearchBar({
 barColor:'#000', 
 showCancel:true,
 height:43,
 top:0,
});
search.addEventListener('cancel', function(){
    search.blur();
});
 
var listView = Ti.UI.createListView({searchView: search, caseInsensitiveSearch: true});
 
var listSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruits = ['Papaya', 'Peach', 'Pear', 'Persimmon', 'Pineapple', 'Pluot', 'Pomegranate'];
var data = [];
for (var i = 0; i < fruits.length; i++) {
data.push({
    properties: {title: fruits[i], searchableText: fruits[i]}
});
}
listSection.setItems(data);
listView.addEventListener('noresults', function(e){
    alert("No results found!");
});
listView.sections = [listSection];
win.add(listView);
win.open();
More infos on this case (Thanks to Sharif): http://developer.appcelerator.com/question/180553/listview-ios-sections-not-honored-while-searchbar-focused

Comments

  1. Mostafizur Rahman 2015-07-05

    Hello [~rtlechuga], We have tested this issue in latest environment . It’s a valid bug. When we search in ListView , related section is not shown on iOS but its perfectly works on Android. *Testing environment:* Titanium SDK: 4.0.0.GA Titanium CLI: 4.0.1 iOS Simulator: 8.1 OS X Version: 10.9.5, Appcelerator Studio: 4.1.0.201506261427 *Testing Code:*
    var win = Ti.UI.createWindow({
       	backgroundColor : 'brown',
       	fullscreen : true
       });
       var search = Titanium.UI.createSearchBar({
       	barColor : '#000',
       	showCancel : true,
       	height : 43,
       	top : 0,
       });
       search.addEventListener('cancel', function() {
       	search.blur();
       });
        
       var listView = Ti.UI.createListView({
       	searchView : search,
       	caseInsensitiveSearch : true,
       	keepSectionsInSearch : true
       });
        
       var listSection = Ti.UI.createListSection({
       	headerTitle : 'Fruits',
        
       });
        
       var fruits = ['Papaya', 'Peach', 'Pear', 'Persimmon', 'Pineapple', 'Pluot', 'Pomegranate'];
       var data = [];
       for (var i = 0; i < fruits.length; i++) {
       	data.push({
       		properties : {
       			title : fruits[i],
       			searchableText : fruits[i]
       		}
       	});
       }
       listSection.setItems(data);
        
       listView.sections = [listSection];
        
       win.add(listView);
       win.open();
       

JSON Source