Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18736] iOS: Wrong height of the headerview and footerview when SearchBar Get Focus, if using Grouped Table Style

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionWon't Fix
Resolution Date2015-04-01T17:51:33.000+0000
Affected Version/sRelease 3.5.1
Fix Version/sn/a
ComponentsiOS
Labelsfooterview, headerview, height, section, tableView
ReporterMarkus Eschenbach
AssigneeIngo Muschenetz
Created2015-03-24T12:00:48.000+0000
Updated2017-03-22T21:31:41.000+0000

Description

Problem description

Set new tabledata during the focus event of the searchbar to force a table refresh. After the refresh the height of the headerView an the footerView of the section is wrong

Steps to reproduce

1. Create a tableview with sections and a searchbar 2. Add a headerView and footerView with height 1 to the sections 3. add add focus eventlistener to the searchbar 4. modify data and set it to the table to force a table refresh

Test case

(function() {
	Ti.UI.backgroundColor = 'white';

	var win = Ti.UI.createWindow({backgroundColor : '#ffffff'});
	var table;
	var view = Titanium.UI.createView({backgroundColor : "#FFFEEE",top : 0});
	
	var section1 = Titanium.UI.createTableViewSection();
	var section2 = Titanium.UI.createTableViewSection();

    section1.headerView = Ti.UI.createView({height: 2, backgroundColor: '#ff0000'}); //red       
    section2.headerView = Ti.UI.createView({height: 2, backgroundColor: '#00ff00'}); //green    
    
    section1.footerView = Ti.UI.createView({height: 2, backgroundColor: '#ff0000'}); //red 
    section2.footerView = Ti.UI.createView({height: 2, backgroundColor: '#00ff00'}); //green
    
	section1.add(Ti.UI.createTableViewRow({title : "Test Row 1"}));
	section2.add(Ti.UI.createTableViewRow({title : "Test Row 2"}));
		
	var search = Titanium.UI.createSearchBar();
	
	search.addEventListener('focus', function(e){
		table.setData(table.data);
	});
	
	table = Ti.UI.createTableView({
		search : search,
		data : [section1,section2],
		style : Ti.UI.iPhone.TableViewStyle.GROUPED
	});

	view.add(table);
	win.add(view);
	
	win.open();
})();	

Attachments

FileDateSize
searchbar-ignore-view-height.png2015-03-24T12:02:30.000+000031839
searchbar-ignore-view-height-focus.png2015-03-24T12:02:30.000+000034410

Comments

  1. Vishal Duggal 2015-04-01

    Use of the searchView API is not recommended with TableViewStyle.GROUPED. That is because the search results are presented in a tableView with style TableViewStyle.PLAIN. If you do wish to use a grouped tableView please see the [searchText](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListView-property-searchText) API in ListView. Use that in conjunction with [keepSectionsInSearch](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListView-property-keepSectionsInSearch) property.
  2. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source