{ "id": "63338", "key": "TIMOB-2706", "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": "2012-07-26T14:30:47.000+0000", "created": "2011-04-15T03:27:32.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [ { "id": "19323", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94532", "key": "TIMOB-9901", "fields": { "summary": "TiAPI: Review and clean up platform bugs and reduce bug count by 20%.", "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": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-26T21:13:17.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

Hi,

\n

I would like to have a tableview which is populated with\ntableviewrows. I add a 'click' event listener to each row. Upon\nclick, I add a label to the row and refresh the table. By doing\nthis I'm hoping to create a drawer effect where more details are\ndisplayed within the selected row.

\n

I want to take this one step further by implementing a second\nclick, such that when the user clicks on the expanded row, the\nlabel is removed and the row shrinks back to its original size.\nHowever, I'm having problems with removing the label. Could someone\nadvise on how to go about doing this? Here is a sample of my\ncode:

\n

// Add row details // // ............... //

\n

row.addEventListener('click',rowExpand);

\n

// Click event function //

\n

function rowExpand(e) {

\n
\nTi.API.info(e.source.nameID);\ne.source.removeEventListener('click',rowExpand);    // Remove click event listener\nvar pos = e.source.nameID;\n\n// Add label\nvar mName =  Titanium.UI.createLabel({\n    text:globaljson[pos].mname,\n    font:{fontSize:12,fontWeight:'normal'},\n    width:'auto',\n    textAlign:'left',\n    top: 50,\n    left:70,\n    height:'auto',\n    touchEnabled:false\n});\n\ndata[pos].add(mName);\ndata[pos].height = 'auto';\ndata[pos].addEventListener('click',function(e){\n    e.source.removeEventListener('click',e.source);\n    data[pos].remove(mName);    // Doesn't work. Why?\n    data[pos].height = 'auto';\n    data[pos].addEventListener('click',rowExpand);\n    tableview.setData(data);\n});\ntableview.setData(data);\n
\n

};

{html}", "attachment": [], "flagged": false, "summary": "How to remove label from tableviewrow?", "creator": { "name": "z3nd", "key": "z3nd", "displayName": "z3nd", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "z3nd", "key": "z3nd", "displayName": "z3nd", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "133072", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "This should have been posted to the Q&A, and it does not include a usecase.\nThus, propose that it be marked invalid and closed.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-05-03T01:55:01.000+0000", "updated": "2011-05-03T01:55:01.000+0000" }, { "id": "209874", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Q&A, not bug.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T14:30:47.000+0000", "updated": "2012-07-26T14:30:47.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }