[TIMOB-16464] Android:ListView:appendSection method not working properly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2017-06-27T20:40:10.000+0000 |
Affected Version/s | Release 3.2.1 |
Fix Version/s | n/a |
Components | Android |
Labels | qe-3.2.1 |
Reporter | Priya Agarwal |
Assignee | Eric Merriman |
Created | 2014-02-14T10:59:08.000+0000 |
Updated | 2017-06-27T20:40:10.000+0000 |
Description
appendSection method not working properly on Android.
It overwrites the previous listView data.
Not a regression as it occurs on 3.2.0.GA also.
Steps to reproduce:
1. Copy paste the code in app.js and run the app.
Expected Result:
1.Should get Header as "Fruits and Fish" and Apple and Banana under Fruits header.
Getting this in iOS.
Actual Result:
1.Getting only Fish Header.
var win = Ti.UI.createWindow({
backgroundColor: 'white',
title: "Search",
navBarHidden: false,
layout: 'vertical'
});
//Create search bar
var listSearch = Titanium.UI.createSearchBar({
barColor:'#C7C7C7',
height: 43,
top: 0
});
//Function to catch click event from Template
function clickEvent (e) {
alert(JSON.stringify(e));
}//
//Template with 2 labels
var plainTemplate = {
childTemplates: [
{ // Title
type: 'Ti.UI.Label', // Use a label for the title
bindId: 'title', // Maps to a custom title property of the item data
properties: { // Sets the label properties
color: '#000',
font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
left: '60dp', top: 0,
},
},
{ // Subtitle
type: 'Ti.UI.Label', // Use a label for the subtitle
bindId: 'subtitle', // Maps to a custom subtitle property of the item data
properties: { // Sets the label properties
color: '#000',
font: { fontFamily:'Arial', fontSize: '14dp' },
left: '60dp', top: '25dp',
}
}
],
// Binds a callback to the click event, which catches events bubbled by the view subcomponents.
events: {click: clickEvent },
properties :{
accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE
}
};
//Create ListView
var listView = Ti.UI.createListView({
templates: { 'template': plainTemplate }, //with template theres no search bar
defaultItemTemplate: 'template', //comment out template and search bar works
searchView: listSearch,
caseInsensitiveSearch: true,
searchHidden: false
});
var sections = []; //array
//Fruit section
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
{ title: {text: 'Apple' }, subtitle: { text: 'Sub sub label' }, searchableText: 'Apple', properties: {title: 'Apple', subtitle: 'Sub sub label', searchableText: 'Apple', itemId: 1, accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE}},
{ title: {text: 'Banana' }, subtitle: { text: 'Sub sub label' }, searchableText: 'Banana', properties: { itemId: 2, title: 'Banana', subtitle: 'Sub sub label', searchableText: 'Banana', accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE }},
{properties: { title: 'Pear', subtitle: 'Sub sub label', searchableText: 'Pear'}},
{properties: { title: 'Orange', subtitle: 'Sub sub label', searchableText: 'Orange'}}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
listView.sections = sections; //assign sections
win.add(listView); //add to win
//Example of appending Fish section
var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});
var fishDataSet = [
{properties: { title: 'Cod', subtitle: 'Sub sub label', searchableText: 'Cod'}},
{properties: { title: 'Haddock', subtitle: 'Sub sub label', searchableText: 'Haddock'}},
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);
win.open();
I am unable to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170623141152 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131