Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7861] iOS: Tableview headers incorrect display when combined with searchBar

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-29T07:57:12.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sSprint 2012-05, Release 2.0.0, Release 1.8.3
ComponentsiOS
Labelsmodule_tableview, qe-testadded
ReporterSandeep Bhimavarapu
AssigneeMax Stepanov
Created2012-03-01T21:25:13.000+0000
Updated2012-03-29T15:56:21.000+0000

Description

This is the case where a tableview is associated with a searchBar. When table rows are filtered using some search text and then new data, with headers, is set to the table on clicking the search button on keyboard ('return' function of the searchBar), then the search filter is applied on the new data but then the headers are also displayed which results in weird display. Please see the attached images for better understanding. *Sample Code* {noformat} // create table view data object var win = Ti.UI.createWindow({ backgroundColor : 'white' }); var data = [ {title:'Alan (click to change index)', hasChild:true, header:'A'}, {title:'Alice', hasDetail:true}, {title:'Alexander'}, {title:'Amos'}, {title:'Alonzo'}, {title:'Brad', header:'B'}, {title:'Brent'}, {title:'Billy'}, {title:'Brenda'}, {title:'Callie', header:'C'}, {title:'Cassie'}, {title:'Chris'}, {title:'Cameron'}, {title:'Don', header:'D'}, {title:'Dilbert'}, {title:'Deacon'}, {title:'Devin'}, {title:'Darin'}, {title:'Darcy'} ]; var search = Titanium.UI.createSearchBar(); // create table view var tableview = Titanium.UI.createTableView({ data:data, search:search, filterAttribute : 'title' }); // set filters var index = [ {title:'A',index:0}, {title:'B',index:5}, {title:'C',index:9}, {title:'D',index:(data.length -1)} ]; tableview.index = index; // add table view to the window win.add(tableview); search.addEventListener('return', function() { tableview.setData(data); }); win.open(); {noformat} *Steps to Reproduce* - Please copy the code into app.js and run the app. - Search for a name in the table, say 'Chr'. - Hit Enter if running on simulator or search if running on device. - You can see new data with search filter and also the headers. *Expected Behavior* - New data is filtered and no headers are seen *Other comments* - The use case is to apply new data, but not the original data again. It was only used for the example.

Attachments

FileDateSize
Search button is hit and new data is applied.png2012-03-01T21:25:13.000+000071738
Search filter applied.png2012-03-01T21:25:13.000+0000101872
Tableview with data.png2012-03-01T21:25:13.000+000079897

Comments

  1. Max Stepanov 2012-03-07

    This is a common iOS issue when UITableView with sections is updated when UISearchDisplayController is active. http://stackoverflow.com/questions/3647319/reloading-uitableview-behind-uisearchdisplaycontroller
  2. Michael Pettiford 2012-03-09

    Closing issue Tested with Ti Studio build 1.0.9.201202141208 Ti Mob SDK 2.0.0.v20120309100238 OSX Lion 10.7.3 Expected behavior is shown of no headers being displayed after searching
  3. Stephen Tramer 2012-03-29

    Reopening to add 1.8.3 to fixversion

JSON Source