{ "id": "115777", "key": "TIMOB-14176", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2015-04-21T23:19:04.000+0000", "created": "2013-06-11T10:08:39.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "listview" ], "versions": [], "issuelinks": [ { "id": "47377", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "119791", "key": "TIMOB-15268", "fields": { "summary": "Android: ListView: Don't create template proxies on the JavaScript side", "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": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T22:03:19.000+0000", "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" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "As per the issue described here\r\n\r\nhttp://developer.appcelerator.com/question/153339/listview-empty-on-android#264068\r\n\r\nUsing the code below displays an empty listview on Android as per the attachment.\r\n\r\nindex.xml\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nindex.js\r\n{code:javascript}\r\nvar section;\r\nvar plainTemplate = {\r\n childTemplates : [{// 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 : '35dp',\r\n height : '35dp',\r\n left : '10dp',\r\n top : '15dp'\r\n }\r\n }, {// Title\r\n type : 'Ti.UI.Label', // Use a label for the title\r\n bindId : 'title', // Maps to a custom title property of the item data\r\n properties : {// Sets the label properties\r\n color : '#373e47',\r\n left : '55dp',\r\n top : '10dp',\r\n right : '10dp',\r\n height : '21dp',\r\n },\r\n }, {// Subtitle\r\n type : 'Ti.UI.Label', // Use a label for the subtitle\r\n bindId : 'date', // Maps to a custom subtitle property of the item data\r\n properties : {// Sets the label properties\r\n color : '#999999',\r\n left : '55dp',\r\n top : '30dp',\r\n }\r\n }],\r\n};\r\n \r\n$.eventsList.templates = {\r\n 'template' : plainTemplate\r\n};\r\n$.eventsList.defaultItemTemplate = 'template';\r\n \r\nfunction loadEvents() {\r\n var eventData = [];\r\n \r\n for (var i = 0; i < 10; i++) {\r\n \r\n \r\n eventData.push({\r\n // Maps to the title component in the template\r\n // Sets the text property of the Label component\r\n title : {\r\n text : \"hello\"\r\n },\r\n // Maps to the subtitle component in the template\r\n // Sets the text property of the Label component\r\n date : {\r\n text : \"hello\"\r\n },\r\n // Maps to the pic component in the template\r\n // Sets the image property of the ImageView component\r\n pic : {\r\n image : \"/default.png\"\r\n },\r\n // Sets the regular list data properties\r\n properties : {\r\n itemId : i,\r\n accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE,\r\n height : \"65dp\"\r\n }\r\n });\r\n \r\n section = Ti.UI.createListSection();\r\n section.setItems(eventData);\r\n $.eventsList.sections = [section];\r\n }\r\n}\r\nloadEvents();\r\n \r\n$.index.open();\r\n{code}\r\n\r\nThis can be resolved by moving the template code into a tss file as such.\r\n\r\nindex.tss\r\n{code:javascript}\r\n\"#eventsList\": {\r\n templates: {\r\n 'template': {\r\n childTemplates : [{// 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 : '35dp',\r\n height : '35dp',\r\n left : '10dp',\r\n top : '15dp'\r\n }\r\n }, {// Title\r\n type : 'Ti.UI.Label', // Use a label for the title\r\n bindId : 'title1', // Maps to a custom title property of the item data\r\n properties : {// Sets the label properties\r\n color : '#373e47',\r\n left : '55dp',\r\n top : '10dp',\r\n right : '10dp',\r\n height : '21dp',\r\n },\r\n }, {// Subtitle\r\n type : 'Ti.UI.Label', // Use a label for the subtitle\r\n bindId : 'date', // Maps to a custom subtitle property of the item data\r\n properties : {// Sets the label properties\r\n color : '#999999',\r\n left : '55dp',\r\n top : '30dp',\r\n }\r\n }]\r\n }\r\n },\r\n defaultItemTemplate: 'template'\r\n}\r\n{code}\r\n\r\nindex.js\r\n{code:javascript}\r\nfunction loadEvents() {\r\n var eventData = [];\r\n \r\n for (var i = 0; i < 10; i++) {\r\n eventData.push({\r\n template: 'template',\r\n \r\n // Maps to the title component in the template\r\n // Sets the text property of the Label component\r\n title1 : {\r\n text : \"hello\"\r\n },\r\n // Maps to the subtitle component in the template\r\n // Sets the text property of the Label component\r\n date : {\r\n text : \"hello\"\r\n },\r\n // Maps to the pic component in the template\r\n // Sets the image property of the ImageView component\r\n pic : {\r\n image : \"/shared.png\"\r\n },\r\n // Sets the regular list data properties\r\n properties : {\r\n itemId : i,\r\n accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE,\r\n height : \"65dp\"\r\n }\r\n });\r\n }\r\n \r\n var section = Ti.UI.createListSection();\r\n section.setItems(eventData);\r\n $.eventsList.sections = [section];\r\n}\r\n \r\n$.index.open();\r\n \r\nloadEvents();\r\n{code}", "attachment": [ { "id": "39705", "filename": "Screen Shot 2013-06-07 at 10.21.03.png", "author": { "name": "plugsheffield", "key": "plugsheffield", "displayName": "Marcus Williams", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-11T10:08:39.000+0000", "size": 18733, "mimeType": "image/png" } ], "flagged": false, "summary": "Android ListView not properly handling templates property post-creation", "creator": { "name": "plugsheffield", "key": "plugsheffield", "displayName": "Marcus Williams", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "plugsheffield", "key": "plugsheffield", "displayName": "Marcus Williams", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OSX 10.8.3", "comment": { "comments": [ { "id": "415076", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate and links to the related ticket has been provided above.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T22:03:19.000+0000", "updated": "2017-03-22T22:03:19.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }