I need custom headerView in table. i made headerView and add in tableView section and i add row in section. i also added search bar on tableView. on Searchbar change it find word from tableView but other unwanted tableViewSection header are also making bad UI.
http://m.UploadEdit.com/b039/1410962986136.jpg title
var tableView = Titanium.UI.createTableView({ top : 21, left : 0, right : 0, seperatorColor : 'red' }); var search = Titanium.UI.createSearchBar(); tableView.search = search; var XHR = require("xhr"); var settingsTableData = []; Ti.App.Properties.setString('f_l', null); new XHR().get('<URL>', function(result) { var js_data = JSON.parse(result.data); var animals = js_data.animals; for (var p in animals) { var viewOne = Ti.UI.createView({ backgroundColor : 'teal', height : 'auto' }); var headerLabel = Ti.UI.createLabel({ font : { fontFamily : 'Helvetica Neue', fontSize : 18, fontWeight : 'bold' }, text : animals[p].name, color : '#222', textAlign : 'left', top : 0, left : 10, width : 300, height : 30 }); viewOne.add(headerLabel); var js_data = { data : animals[p] }; var rows = Alloy.createController('row', js_data).getView(); if (Ti.App.Properties.getString('f_l') != animals[p].name.charAt(0)) { var sec = Ti.UI.createTableViewSection({ headerView : viewOne }); Ti.App.Properties.setString('f_l', animals[p].name.charAt(0)); } else { var sec = Ti.UI.createTableViewSection({}); } sec.add(rows); settingsTableData.push(sec); } tableView.setData(settingsTableData); }, function() { alert('error'); }); filterAttribute = (Titanium.Platform.osname == "android") ? 'title' : 'filter'; $.index.add(tableView); $.index.open();