Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1298] iOS: ListView separator disappear when set background to custom template view

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-11-04T18:21:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsTCSupportTriage, listView, separator
ReporterFar
AssigneeMauro Parra-Miranda
Created2014-08-19T21:03:49.000+0000
Updated2016-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

FileDateSize
IMG_0118.PNG2014-08-19T21:05:32.000+000028062

Comments

  1. Mostafizur Rahman 2014-08-20

    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:*
    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();
    *TESTING RESULTS:* Separator between second and third row will not disappear in iPod device and also simulator.
  2. Ed 2014-09-19

    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().
  3. Far 2014-11-06

    All ok on iOS 8.x. Look like the problem is 7.x specific.

JSON Source