| GitHub Issue | n/a |
| Type | Improvement |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-02-28T22:41:39.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | 2014 Sprint 05, 2014 Sprint 05 API, Release 3.3.0 |
| Components | iOS |
| Labels | listview, module_listview, qe-closed-3.3.0, qe-testadded |
| Reporter | levani |
| Assignee | Vishal Duggal |
| Created | 2014-02-21T19:31:36.000+0000 |
| Updated | 2014-04-25T09:06:12.000+0000 |
I'm using PullView to implement "Release to refresh" functionality, but the problem is that I can't change the background color above the PullView itself. When I scroll down more than the height of PullView some default grey background appears that I would like to change. See attached image for example.
I'm also attaching a very simple app with listview only. The background color of pullview if pink, everything that appears above that pullview when you scroll down is always grey!
P.S. If this area isn't a background and it has it's own name please change the title accordingly.
Sample code showing use of pullBackgroundColor on Ti.UI.View and noresults event in ListView
var win = Ti.UI.createWindow({backgroundColor: 'white',fullscreen:true,layout:'vertical'}); var listView = Ti.UI.createListView({keepSectionsInSearch:true}); var sections = []; var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'}); var fruitDataSet = [ {properties: { title: 'Fig', searchableText: 'Fruits Apple'}}, {properties: { title: 'Kiwi', searchableText: 'Fruits Banana'}}, ]; fruitSection.setItems(fruitDataSet); sections.push(fruitSection); var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'}); var vegDataSet = [ {properties: { title: 'Carrots', searchableText: 'Vegetables Carrots'}}, {properties: { title: 'Potatoes', searchableText: 'Vegetables Potatoes'}}, ]; vegSection.setItems(vegDataSet); var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'}); var fishDataSet = [ {properties: { title: 'Cod', searchableText: 'Fish Cod'}}, {properties: { title: 'Haddock', searchableText: 'Fish Haddock'}}, ]; fishSection.setItems(fishDataSet); listView.sections = sections; var refreshCount = 0; function getFormattedDate(){ var date = new Date(); return date.getMonth() + '/' + date.getDate() + '/' + date.getFullYear() + ' ' + date.getHours() + ':' + date.getMinutes(); } function resetPullHeader(){ actInd.hide(); imageArrow.transform=Ti.UI.create2DMatrix(); if (refreshCount < 2) { imageArrow.show(); labelStatus.text = 'Pull down to refresh...'; labelLastUpdated.text = 'Last Updated: ' + getFormattedDate(); } else { labelStatus.text = 'Nothing To Refresh'; labelLastUpdated.text = 'Last Updated: ' + getFormattedDate(); listView.removeEventListener('pull', pullListener); listView.removeEventListener('pullend', pullendListener); eventStatus.text = 'Removed event listeners.'; } listView.setContentInsets({top:0}, {animated:true}); } function loadTableData() { if (refreshCount == 0) { listView.appendSection(vegSection); } else if (refreshCount == 1) { listView.appendSection(fishSection); } refreshCount ++; resetPullHeader(); } function pullListener(e){ eventStatus.text = 'EVENT pull FIRED. e.active = '+e.active; if (e.active == false) { var unrotate = Ti.UI.create2DMatrix(); imageArrow.animate({transform:unrotate, duration:180}); labelStatus.text = 'Pull down to refresh...'; } else { var rotate = Ti.UI.create2DMatrix().rotate(180); imageArrow.animate({transform:rotate, duration:180}); if (refreshCount == 0) { labelStatus.text = 'Release to get Vegetables...'; } else { labelStatus.text = 'Release to get Fish...'; } } } function pullendListener(e){ eventStatus.text = 'EVENT pullend FIRED.'; if (refreshCount == 0) { labelStatus.text = 'Loading Vegetables...'; } else { labelStatus.text = 'Loading Fish...'; } imageArrow.hide(); actInd.show(); listView.setContentInsets({top:80}, {animated:true}); setTimeout(function(){ loadTableData(); }, 2000); } var tableHeader = Ti.UI.createView({ backgroundColor:'#e2e7ed', pullBackgroundColor: 'cyan', width:320, height:80 }); var border = Ti.UI.createView({ backgroundColor:'#576c89', bottom:0, height:2 }); tableHeader.add(border); var imageArrow = Ti.UI.createImageView({ image:'https://github.com/appcelerator/titanium_mobile/raw/master/demos/KitchenSink/Resources/images/whiteArrow.png', left:20, bottom:10, width:23, height:60 }); tableHeader.add(imageArrow); var labelStatus = Ti.UI.createLabel({ color:'#576c89', font:{fontSize:13, fontWeight:'bold'}, text:'Pull down to refresh...', textAlign:'center', left:55, bottom:30, width:200 }); tableHeader.add(labelStatus); var labelLastUpdated = Ti.UI.createLabel({ color:'#576c89', font:{fontSize:12}, text:'Last Updated: ' + getFormattedDate(), textAlign:'center', left:55, bottom:15, width:200 }); tableHeader.add(labelLastUpdated); var actInd = Ti.UI.createActivityIndicator({ left:20, bottom:13, width:30, height:30 }); tableHeader.add(actInd); listView.pullView = tableHeader; listView.addEventListener('pull', pullListener); listView.addEventListener('pullend',pullendListener); var eventStatus = Ti.UI.createLabel({ font:{fontSize:13, fontWeight:'bold'}, text: 'Event data will show here', }) var searchbar = Ti.UI.createSearchBar({ showCancel: true, hintText: 'Search' }); searchbar.addEventListener('cancel',function(e){ searchbar.value = ''; searchbar.blur(); listView.searchText = ''; }); searchbar.addEventListener('return',function(e){ listView.searchText = searchbar.value; searchbar.blur(); }); listView.addEventListener('noresults',function(){ alert('No results for searchText '+searchbar.value); }) win.add(eventStatus); win.add(searchbar); win.add(listView); win.open();Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/5391
Thanks for the update, As i am using the latest CI build, i was able to incorporate this functionality into my app. However the documentation is a little weird. The "pullBackgroundColor" is listed as a property of the listView itself. Trying to set it there doesn't work, as it must set on the view contained by the pullView property. Having it as part of of listView and View make sense in this circumstance. But perhaps the functionality should also be part of the listView rather then view. Both?
@[~paul h] pullBackgroundColor is a property of Ti.UI.View and so gets inherited by all UI components extending Ti.UI.View (ListView, TableView, Window, TabGroup etc). In theory you can assign a TableView or ListView as the pullView for another TableView/ListView (though I suspect it would not work as expected).
Verified fix with below environment: Appc Studio: 3.3.0.201404211130 SDK build: 3.3.0.v20140423155715 acs: 1.0.14 npm: 1.3.2 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1-beta1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) Device: iPhone 5C(7.1) Able to change the color of area above the pullview through pullBackgroundColor property as expected. Hence Closing the issue.