{ "id": "106282", "key": "TIMOB-12022", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-02-20T15:28:12.000+0000", "created": "2012-12-11T17:20:24.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2017-03-28T20:54:01.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": "Run the attached program.\r\n\r\nClick on a section\r\n\r\nActual results: Section number is always 12\r\n\r\nExpected results: Section number should be 1 to 12\r\n\r\n{code}\r\nvar RED = 'Red',\r\n GREEN = 'Green',\r\n PURPLE = 'Purple';\r\n \r\nvar win1 = Titanium.UI.createWindow({ \r\n backgroundColor:'#fff',\r\n layout: 'vertical'\r\n});\r\n \r\nvar table = Ti.UI.createTableView({\r\n \r\n});\r\n \r\nvar tableSection1 = createSectionForGroup(RED);\r\nvar tableSection2 = createSectionForGroup(GREEN);\r\nvar tableSection3 = createSectionForGroup(PURPLE);\r\nvar tableSection4 = createSectionForGroup(PURPLE);\r\nvar tableSection5 = createSectionForGroup(RED);\r\nvar tableSection6 = createSectionForGroup(GREEN);\r\nvar tableSection7 = createSectionForGroup(PURPLE);\r\nvar tableSection8 = createSectionForGroup(PURPLE);\r\nvar tableSection9 = createSectionForGroup(RED);\r\nvar tableSection10 = createSectionForGroup(GREEN);\r\nvar tableSection11 = createSectionForGroup(PURPLE);\r\nvar tableSection12 = createSectionForGroup(PURPLE);\r\n \r\nvar tableRow = Ti.UI.createTableViewRow({\r\n title:'Row'\r\n});\r\n \r\nvar rows = 7;\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection1.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection2.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection3.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection4.add(tableRow);\r\n}\r\n\r\nfor(i=0; i<=rows; i++) {\r\n tableSection5.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection6.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection7.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection8.add(tableRow);\r\n}\r\n\r\nfor(i=0; i<=rows; i++) {\r\n tableSection9.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection10.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection11.add(tableRow);\r\n}\r\n \r\nfor(i=0; i<=rows; i++) {\r\n tableSection12.add(tableRow);\r\n}\r\n \r\n tableSection1.addEventListener( 'click', function( e ) {\r\n alert( 'section 1 was clicked' );\r\n });\r\n \r\n tableSection2.addEventListener( 'click', function( e ) {\r\n alert( 'section 2 was clicked' );\r\n });\r\n \r\n tableSection3.addEventListener( 'click', function( e ) {\r\n alert( 'section 3 was clicked' );\r\n });\r\n \r\n tableSection4.addEventListener( 'click', function( e ) {\r\n alert( 'section 4 was clicked' );\r\n });\r\n \r\n tableSection5.addEventListener( 'click', function( e ) {\r\n alert( 'section 5 was clicked' );\r\n });\r\n \r\n tableSection6.addEventListener( 'click', function( e ) {\r\n alert( 'section 6 was clicked' );\r\n });\r\n \r\n tableSection7.addEventListener( 'click', function( e ) {\r\n alert( 'section 7 was clicked' );\r\n });\r\n \r\n tableSection8.addEventListener( 'click', function( e ) {\r\n alert( 'section 8 was clicked' );\r\n });\r\n \r\n \r\n tableSection9.addEventListener( 'click', function( e ) {\r\n alert( 'section 9 was clicked' );\r\n });\r\n \r\n tableSection10.addEventListener( 'click', function( e ) {\r\n alert( 'section 10 was clicked' );\r\n });\r\n \r\n tableSection11.addEventListener( 'click', function( e ) {\r\n alert( 'section 11 was clicked' );\r\n });\r\n \r\n tableSection12.addEventListener( 'click', function( e ) {\r\n alert( 'section 12 was clicked' );\r\n });\r\n \r\n \r\n \r\ntable.setData([tableSection1, tableSection2, tableSection3, tableSection4, tableSection5, tableSection6, tableSection7, tableSection8,\r\n\ttableSection9, tableSection10, tableSection11, tableSection12]);\r\nwin1.add(table);\r\n \r\n// open tab group\r\nwin1.open();\r\n \r\n \r\nfunction createSectionForGroup(group) {\r\n var headerContainerOpts, headerBottomBorderOpts, headerViewOpts;\r\n \r\n headerViewOpts = {\r\n color: 'white',\r\n height: Ti.UI.SIZE,\r\n font: { fontSize: '17sp', fontWeight: 'bold' },\r\n left: 11,\r\n text: group\r\n };\r\n \r\n if (group === RED) {\r\n headerContainerOpts = {\r\n backgroundGradient: {\r\n endPoint: { x: 0, y: '100%' },\r\n startPoint: { x: 0, y: 0 },\r\n type: 'linear',\r\n colors: ['#C53019', '#B32D14']\r\n },\r\n height: 32\r\n };\r\n }\r\n if (group === GREEN) {\r\n headerContainerOpts = {\r\n backgroundGradient: {\r\n endPoint: { x: 0, y: '100%' },\r\n startPoint: { x: 0, y: 0 },\r\n type: 'linear',\r\n colors: ['#2B781E', '#195010']\r\n },\r\n height: 32\r\n };\r\n }\r\n if (group === PURPLE) {\r\n headerContainerOpts = {\r\n backgroundGradient: {\r\n endPoint: { x: 0, y: '100%' },\r\n startPoint: { x: 0, y: 0 },\r\n type: 'linear',\r\n colors: ['#873DA6', '#612A7D']\r\n },\r\n height: 32\r\n };\r\n }\r\n \r\n var container = Ti.UI.createView(headerContainerOpts);\r\n container.add(Ti.UI.createLabel(headerViewOpts));\r\n return Ti.UI.createTableViewSection({\r\n headerView: container,\r\n title: group\r\n });\r\n}\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: TableView section number wrong on events fired", "creator": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android 4.2 on Nexus 7", "comment": { "comments": [ { "id": "231646", "author": { "name": "salachi", "key": "salachi", "displayName": "sunil alachi", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I think the issue is because the same tableRow is added to different sections, parent section for the row is updated each time with the new section and the last section sticks.\r\nWhen the row is clicked, since the parent is updated with the last section, it calls the handler for the last section.\r\nTry creating different tableRows", "updateAuthor": { "name": "salachi", "key": "salachi", "displayName": "sunil alachi", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-12-17T16:18:19.000+0000", "updated": "2012-12-17T16:18:19.000+0000" }, { "id": "293934", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Since the same tablerow is added to all the section, tablerow get updated with the last section that was added to. Use different tablerow objects", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-02-20T15:28:12.000+0000", "updated": "2014-02-20T15:28:12.000+0000" }, { "id": "416051", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-28T20:54:01.000+0000", "updated": "2017-03-28T20:54:01.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }