{ "id": "117220", "key": "AC-1970", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-07-16T22:53:52.000+0000", "created": "2013-07-16T12:55:59.000+0000", "labels": [ "hasCheck", "ios", "tableviewrow", "toggle" ], "versions": [], "issuelinks": [], "assignee": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:40:54.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Try to toggle the hasCheck property of TableViewRow using click event but its not behaving properly as expected. I found it working properly in Android but not working in iOS\r\n\r\n\r\nPlease find the sample code attached below.\r\n{code:title=Sample|borderStyle=solid} \r\nfunction TestView() { \r\n var data = [];\r\n var self = Titanium.UI.createTableView({ \r\n data : data,\r\n }); \r\n for (i = 0; i < 5; i++) {\r\n var section = Titanium.UI.createTableViewSection({headerTitle: \"section\"+i}); \r\n for (j = 0; j < 5; j++) {\r\n var row = Ti.UI.createTableViewRow({\r\n title : \"row\"+j\r\n });\r\n section.add(row); \r\n }\r\n self.appendSection(section)\r\n }\r\n self.addEventListener('click', function(e) {\r\n e.row.hasCheck = !e.row.hasCheck;\r\n });\r\n return self;\r\n}\r\nmodule.exports = TestView;\r\n{code} \r\n\r\n\r\n*Result*\r\nOn clicking any table view row, it is unable to toggle a check mark on the right side of the row clicked\r\n\r\n*Expected*\r\nOn clicking any table view row, it should toggle the check mark on the right side of the row clicked", "attachment": [ { "id": "40782", "filename": "iOS Simulator Screen shot 16-Jul-2013 6.36.34 PM.png", "author": { "name": "speedyankur@gmail.com", "key": "speedyankur@gmail.com", "displayName": "ankur garha", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-07-16T13:07:00.000+0000", "size": 18970, "mimeType": "image/png" } ], "flagged": false, "summary": "TableViewRow hasCheck property not getting toggled on click event", "creator": { "name": "speedyankur@gmail.com", "key": "speedyankur@gmail.com", "displayName": "ankur garha", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "speedyankur@gmail.com", "key": "speedyankur@gmail.com", "displayName": "ankur garha", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "*Application type*: mobile\r\n*Titanium SDK*: 3.1.1 GA and 3.1.0 GA\r\n*Platform & version*: iOS 6.1\r\n*Device*: iOS simulator\r\n*Host Operating System*: OSX 10.8.4\r\n*Titanium Studio*: build: 3.1.0.201304151600", "comment": { "comments": [ { "id": "262116", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello Ankur,\r\n\r\nI did some research into your issue and have found the root of the problem as well as a solution for you. When I looked over the documents for appendSection()(http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.TableView-method-appendSection) I first noticed this warning in the page: \"Due to a known issue, TIMOB-12616, this method should not be used for adding sections on iOS.\" This is probably the reason why this code is not working for you.\r\n\r\nInstead, I did some tinkering and came up with a solution for you. Instead of using appendSection(), I pushed the created sections into the data array and used setData() to set the sections into the table and everything worked perfectly for both Android and iOS.\r\n\r\nHere is the sample code I came up with:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nvar data = [];\r\nvar self = Titanium.UI.createTableView({\r\n});\r\n\r\nfor ( i = 0; i < 5; i++) {\r\n\tvar section = Titanium.UI.createTableViewSection({\r\n\t\theaderTitle : \"section\" + i\r\n\t});\r\n\tfor ( j = 0; j < 5; j++) {\r\n\t\tvar row = Ti.UI.createTableViewRow({\r\n\t\t\ttitle : \"row\" + j\r\n\t\t});\r\n\t\tsection.add(row);\r\n\t}\r\n\tdata.push(section);\r\n}\r\nself.setData(data);\r\n\r\nself.addEventListener('click', function(e) {\r\n\tif (e.row.hasCheck) {\r\n\t\te.row.hasCheck = false;\r\n\t} else {\r\n\t\te.row.hasCheck = true;\r\n\t}\r\n});\r\nwin.add(self);\r\nwin.open();\r\n{code}\r\n\r\nI am going to resolve this issue for now. If you have any further questions don't hesitate to ask.\r\n\r\nBest,\r\n\r\nCarter", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-07-16T22:51:02.000+0000", "updated": "2013-07-16T22:52:35.000+0000" }, { "id": "286027", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Since we have not heard from the reporter and a recommendation to fix the code has been posted, closing this.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-28T00:00:42.000+0000", "updated": "2013-12-28T00:00:42.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }