{ "id": "130612", "key": "ALOY-1029", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2014-05-19T10:21:23.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "community", "listview" ], "versions": [ { "id": "15759", "description": "Alloy 1.3.1", "name": "Alloy 1.3.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [ { "id": "40807", "type": { "id": "10000", "name": "Blocks", "inward": "is blocked by", "outward": "blocks" }, "inwardIssue": { "id": "135980", "key": "TIMOB-17596", "fields": { "summary": "Android: ListView: add support for specifying templates post-creation as is possible on iOS", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2015-06-08T17:39:23.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "I get this demo from http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListView\r\nJust change the image url\r\nIt looks good on iOS\r\nBut show label text on Android\r\nAnd show this error\r\n[ERROR] : TiTemplate: (main) [68,68] Please use 'properties' binding for builtInTemplate\r\n", "attachment": [ { "id": "48198", "filename": "2014_05_19_17.14.35.png", "author": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-05-19T10:21:23.000+0000", "size": 71558, "mimeType": "image/png" }, { "id": "48197", "filename": "Screen Shot 2014-05-19 at 5.08.43 PM.png", "author": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-05-19T10:21:23.000+0000", "size": 102793, "mimeType": "image/png" }, { "id": "48199", "filename": "ti-test.zip", "author": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-05-19T10:21:23.000+0000", "size": 6479066, "mimeType": "application/zip" } ], "flagged": false, "summary": "Listview code errs on Android but works on iOS platform", "creator": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "subtasks": [], "reporter": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "environment": "Ti SDK 3.2.3\r\nAndroid 4.4.2, Nexus 7 2013", "comment": { "comments": [ { "id": "305568", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I ran the sample provided in the documentation and it worked fine. I changed the image url. Here is the code I tested.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\r\n// Create a custom template that displays an image on the left, \r\n// then a title next to it with a subtitle below it.\r\nvar myTemplate = {\r\n childTemplates: [\r\n { // Image justified left\r\n type: 'Ti.UI.ImageView', // Use an image view for the image\r\n bindId: 'pic', // Maps to a custom pic property of the item data\r\n properties: { // Sets the image view properties\r\n width: '50dp', height: '50dp', left: 0\r\n }\r\n },\r\n { // Title \r\n type: 'Ti.UI.Label', // Use a label for the title \r\n bindId: 'info', // Maps to a custom info property of the item data\r\n properties: { // Sets the label properties\r\n color: 'black',\r\n font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },\r\n left: '60dp', top: 0,\r\n }\r\n },\r\n { // Subtitle\r\n type: 'Ti.UI.Label', // Use a label for the subtitle\r\n bindId: 'es_info', // Maps to a custom es_info property of the item data\r\n properties: { // Sets the label properties\r\n color: 'gray',\r\n font: { fontFamily:'Arial', fontSize: '14dp' },\r\n left: '60dp', top: '25dp',\r\n }\r\n }\r\n ]\r\n};\r\n\r\nvar listView = Ti.UI.createListView({\r\n // Maps myTemplate dictionary to 'template' string\r\n templates: { 'template': myTemplate },\r\n // Use 'template', that is, the myTemplate dict created earlier\r\n // for all items as long as the template property is not defined for an item.\r\n defaultItemTemplate: 'template'\r\n});\r\nvar sections = [];\r\n\r\nvar fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});\r\nvar fruitDataSet = [\r\n // the text property of info maps to the text property of the title label\r\n // the text property of es_info maps to text property of the subtitle label\r\n // the image property of pic maps to the image property of the image view\r\n { info: {text: 'Apple'}, es_info: {text: 'Manzana'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Banana'}, es_info: {text: 'Banana'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\nfruitSection.setItems(fruitDataSet);\r\nsections.push(fruitSection);\r\n\r\nvar vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'});\r\nvar vegDataSet = [\r\n { info: {text: 'Carrot'}, es_info: {text: 'Zanahoria'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Potato'}, es_info: {text: 'Patata'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\nvegSection.setItems(vegDataSet);\r\nsections.push(vegSection);\r\n\r\nvar grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'});\r\nvar grainDataSet = [\r\n { info: {text: 'Corn'}, es_info: {text: 'Maiz'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Rice'}, es_info: {text: 'Arroz'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\ngrainSection.setItems(grainDataSet);\r\nsections.push(grainSection);\r\n\r\nlistView.setSections(sections);\r\nwin.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-19T19:13:53.000+0000", "updated": "2014-05-19T19:13:53.000+0000" }, { "id": "305645", "author": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "body": "Your code works.\r\nWhen i change it to use Alloy. It does not work anymore\r\n\r\n{code:title=index.xml|borderStyle=solid}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n{code:title=index.js|borderStyle=solid}\r\n// Create a custom template that displays an image on the left, \r\n// then a title next to it with a subtitle below it.\r\nvar myTemplate = {\r\n childTemplates: [\r\n { // Image justified left\r\n type: 'Ti.UI.ImageView', // Use an image view for the image\r\n bindId: 'pic', // Maps to a custom pic property of the item data\r\n properties: { // Sets the image view properties\r\n width: '50dp', height: '50dp', left: 0\r\n }\r\n },\r\n { // Title \r\n type: 'Ti.UI.Label', // Use a label for the title \r\n bindId: 'info', // Maps to a custom info property of the item data\r\n properties: { // Sets the label properties\r\n color: 'black',\r\n font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },\r\n left: '60dp', top: 0,\r\n }\r\n },\r\n { // Subtitle\r\n type: 'Ti.UI.Label', // Use a label for the subtitle\r\n bindId: 'es_info', // Maps to a custom es_info property of the item data\r\n properties: { // Sets the label properties\r\n color: 'gray',\r\n font: { fontFamily:'Arial', fontSize: '14dp' },\r\n left: '60dp', top: '25dp',\r\n }\r\n }\r\n ]\r\n};\r\n \r\n// var listView = Ti.UI.createListView({\r\n // // Maps myTemplate dictionary to 'template' string\r\n // templates: { 'template': myTemplate },\r\n // // Use 'template', that is, the myTemplate dict created earlier\r\n // // for all items as long as the template property is not defined for an item.\r\n // defaultItemTemplate: 'template'\r\n// });\r\n\r\n$.gallery.templates = { 'template': myTemplate };\r\n$.gallery.defaultItemTemplate = 'template';\r\n\r\nvar sections = [];\r\n \r\nvar fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});\r\nvar fruitDataSet = [\r\n // the text property of info maps to the text property of the title label\r\n // the text property of es_info maps to text property of the subtitle label\r\n // the image property of pic maps to the image property of the image view\r\n { info: {text: 'Apple'}, es_info: {text: 'Manzana'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Banana'}, es_info: {text: 'Banana'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\nfruitSection.setItems(fruitDataSet);\r\nsections.push(fruitSection);\r\n \r\nvar vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras'});\r\nvar vegDataSet = [\r\n { info: {text: 'Carrot'}, es_info: {text: 'Zanahoria'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Potato'}, es_info: {text: 'Patata'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\nvegSection.setItems(vegDataSet);\r\nsections.push(vegSection);\r\n \r\nvar grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos'});\r\nvar grainDataSet = [\r\n { info: {text: 'Corn'}, es_info: {text: 'Maiz'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}},\r\n { info: {text: 'Rice'}, es_info: {text: 'Arroz'}, pic: {image: 'http://allthingsd.com/files/2012/11/appcelerator-logo-feature-380x285.png'}}\r\n];\r\ngrainSection.setItems(grainDataSet);\r\nsections.push(grainSection);\r\n \r\n$.gallery.setSections(sections);\r\n\r\nvar win = $.getView();\r\n// win.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-05-20T02:54:50.000+0000", "updated": "2014-05-20T02:59:30.000+0000" }, { "id": "305646", "author": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "body": "http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListView-property-templates\r\n\r\ntemplates property is creation only.\r\nMy test case is wrong.\r\nBut why iOS is still working?", "updateAuthor": { "name": "ptquang86", "key": "ptquang86", "displayName": "Quang Pham", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-05-20T03:39:14.000+0000", "updated": "2014-05-20T03:39:14.000+0000" }, { "id": "306035", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this ticket to engineering as I can reproduce this issue on Android platform with the provided test case. Works fine on iOS platform. Titanium code works on both iOS and Android platforms.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-22T05:06:27.000+0000", "updated": "2014-05-22T05:06:27.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }