[TIMOB-7861] iOS: Tableview headers incorrect display when combined with searchBar
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-29T07:57:12.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Sprint 2012-05, Release 2.0.0, Release 1.8.3 |
Components | iOS |
Labels | module_tableview, qe-testadded |
Reporter | Sandeep Bhimavarapu |
Assignee | Max Stepanov |
Created | 2012-03-01T21:25:13.000+0000 |
Updated | 2012-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
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
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
Reopening to add 1.8.3 to fixversion