[AC-1298] iOS: ListView separator disappear when set background to custom template view
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2014-11-04T18:21:32.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | TCSupportTriage, listView, separator |
Reporter | Far |
Assignee | Mauro Parra-Miranda |
Created | 2014-08-19T21:03:49.000+0000 |
Updated | 2016-03-08T07:37:41.000+0000 |
Description
Test app:
var template = {
properties: {
name: 'template'
},
childTemplates: [{
type: 'Ti.UI.View',
bindId: 'container',
childTemplates: [{
type: 'Ti.UI.Label',
bindId: 'info'
}]
}]
};
var section = Ti.UI.createListSection();
section.setItems([
{info: {text: 'Cod'}, properties: {active: false}, container: {}},
{info: {text: 'Haddock'}, properties: {active: false}, container: {}},
{info: {text: 'Fish'}, properties: {active: false}, container: {}},
{info: {text: 'Clam'}, properties: {active: false}, container: {}}
]);
var list = Ti.UI.createListView({
templates: {template: template},
defaultItemTemplate: 'template'
});
list.appendSection(section);
list.addEventListener('itemclick', function(e) {
var item = e.section.getItemAt(e.itemIndex);
item.active = !item.active;
item.container.backgroundColor = item.active? 'orange': 'white';
e.section.updateItemAt(e.itemIndex, item);
});
var win = Ti.UI.createWindow();
win.add(list);
win.open();
Steps to reproduce:
1. Click third row
2. Click third row again
As result separator between second and third row disappear. Bug is reproducible on device only.
Attachments
File | Date | Size |
---|---|---|
IMG_0118.PNG | 2014-08-19T21:05:32.000+0000 | 28062 |
Hello, We have tested this issue with our sample code. Its not a bug. Its working as we expected. *TESTING ENVIRONMENT:* Titanium SDK: 3.3.0.GA and 3.2.3.GA Titanium CLI: 3.3.0 OS X Version: 10.9.3 iOS Device: iPod 5G iOS Version: 7.1.2 Android API Level: 17 and 19 *STEPS TO REPRODUCE:* a) Create a simple project. b) Update this code in app.js c) Run this with testing environment d) Click third row e) Click third row again *TESTING CODE:*
*TESTING RESULTS:* Separator between second and third row will not disappear in iPod device and also simulator.
I experience the same issue, device (iOS 8), simulator (7.1.2), and Ti SDK 3.3.0. It happens when you update a templated item row using the .updateItemAt() method. I found a workaround, which is to de-select the row with the list view's .deselectItem() before calling .updateItemAt().
All ok on iOS 8.x. Look like the problem is 7.x specific.