{ "id": "149271", "key": "TIMOB-19335", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-06-30T19:00:25.000+0000", "created": "2015-06-30T10:40:25.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "editActions", "listview", "qe-6.0.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-09-29T16:53:47.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": "Since 4.1.0.Beta we got a really super-duper feature: https://docs.appcelerator.com/platform/latest/#!/guide/ListViews-section-37521650_ListViews-ActionItems\r\n\r\nBut one thing is not really charming. The listener for which action is pressed by the user has to be the title of the edit button? That seems very untypical.\r\n\r\n*Existing example*\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'}),\r\n favoriteAction = {\r\n title: 'Favorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_DEFAULT\r\n },\r\n unfavoriteAction = {\r\n title: 'Unfavorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_NORMAL\r\n },\r\n data = [\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Kitten Whiskers'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Copper Kettle'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Woolen Mittens'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Apple Strudel'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Brown Packages'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Dog Bites'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Bee Stings'}}\r\n ],\r\n listSection = Ti.UI.createListSection({\r\n items: data\r\n }),\r\n listView = Ti.UI.createListView({\r\n top: 15,\r\n sections: [listSection]\r\n });\r\nlistView.addEventListener('editaction', function(e) {\r\n var item = e.section.getItemAt(e.itemIndex)\r\n if (e.action === 'Favorite') {\r\n item.properties.editActions = [unfavoriteAction];\r\n } else if (e.action === 'Unfavorite') {\r\n item.properties.editActions = [favoriteAction];\r\n }\r\n e.section.updateItemAt(e.itemIndex, item);\r\n});\r\n \r\nwin.add(listView);\r\nwin.open();\r\n{code}\r\n\r\n*Should be example*\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'}),\r\n favoriteAction = {\r\n \taction: 'setFavorite',\r\n title: 'Favorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_DEFAULT\r\n },\r\n unfavoriteAction = {\r\n \taction: 'unsetFavorite',\r\n title: 'Unfavorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_NORMAL\r\n },\r\n data = [\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Kitten Whiskers'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Copper Kettle'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Woolen Mittens'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Apple Strudel'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Brown Packages'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Dog Bites'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Bee Stings'}}\r\n ],\r\n listSection = Ti.UI.createListSection({\r\n items: data\r\n }),\r\n listView = Ti.UI.createListView({\r\n top: 15,\r\n sections: [listSection]\r\n });\r\nlistView.addEventListener('editaction', function(e) {\r\n var item = e.section.getItemAt(e.itemIndex)\r\n if (e.action === 'setFavorite') {\r\n item.properties.editActions = [unfavoriteAction];\r\n } else if (e.action === 'unsetFavorite') {\r\n item.properties.editActions = [favoriteAction];\r\n }\r\n e.section.updateItemAt(e.itemIndex, item);\r\n});\r\n \r\nwin.add(listView);\r\nwin.open();\r\n{code}\r\n\r\nAs you see, the developer can define the action himself. Otherwise I have to compare on localized strings. That's not a good coding behavior .\r\n\r\nWhat do you think?", "attachment": [], "flagged": false, "summary": "iOS: ListView editActions specify better action", "creator": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 678, "state": "closed", "name": "2016 Sprint 14 SDK", "startDate": "2016-07-02T00:25:57.921Z", "endDate": "2016-07-16T00:25:00.000Z", "completeDate": "2016-07-18T03:18:29.729Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "382169", "author": { "name": "bearus", "key": "bearus", "displayName": "Be Rushton", "active": true, "timeZone": "Australia/Brisbane" }, "body": "I'd like to see this too.", "updateAuthor": { "name": "bearus", "key": "bearus", "displayName": "Be Rushton", "active": true, "timeZone": "Australia/Brisbane" }, "created": "2016-04-08T07:13:59.000+0000", "updated": "2016-04-08T07:13:59.000+0000" }, { "id": "389381", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~benutzername], good improvement! 90 % agree, but can we name it {{identifier}} instead of {{action}}? to have parity with other identifier-based API's? -I also noticed, that we don't have a {{Ti.UI.iOS.ListViewEditAction}} proxy that would ease the additional property immense. So currently I'm trying to extend the current UI-element by the identifier, but that's a mess. We should introduce the proxy for 6.0.0 / 6.1.0 ^^- EDIT: That's way too much overhead for that API. Figured it out more easy.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-06-29T07:22:47.000+0000", "updated": "2016-06-29T07:38:38.000+0000" }, { "id": "389382", "author": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "body": "I agree with _identifier_", "updateAuthor": { "name": "benutzername", "key": "benutzername", "displayName": "Sebastian Klaus", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-06-29T07:24:05.000+0000", "updated": "2016-06-29T07:24:05.000+0000" }, { "id": "389383", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/8097\r\n\r\nDemo:\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white'}),\r\n favoriteAction = {\r\n \tidentifier: 'setFavorite',\r\n title: 'Favorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_DEFAULT\r\n },\r\n unfavoriteAction = {\r\n \tidentifier: 'unsetFavorite',\r\n title: 'Unfavorite',\r\n style: Ti.UI.iOS.ROW_ACTION_STYLE_NORMAL\r\n },\r\n data = [\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Kitten Whiskers'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Copper Kettle'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Woolen Mittens'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Apple Strudel'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Brown Packages'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Dog Bites'}},\r\n {properties: {canEdit: true, editActions: [favoriteAction], title: 'Bee Stings'}}\r\n ],\r\n listSection = Ti.UI.createListSection({\r\n items: data\r\n }),\r\n listView = Ti.UI.createListView({\r\n top: 15,\r\n sections: [listSection]\r\n });\r\nlistView.addEventListener('editaction', function(e) {\r\n var item = e.section.getItemAt(e.itemIndex)\r\n if (e.identifier === 'setFavorite') {\r\n item.properties.editActions = [unfavoriteAction];\r\n } else if (e.identifier === 'unsetFavorite') {\r\n item.properties.editActions = [favoriteAction];\r\n }\r\n e.section.updateItemAt(e.itemIndex, item);\r\n});\r\n \r\nwin.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-06-29T07:39:31.000+0000", "updated": "2016-06-30T17:33:22.000+0000" }, { "id": "397651", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, {{identifier}} can be set to define the action, as opposed to the title.\r\n\r\nTested On:\r\n\r\niPhone 6 Plus 10.0.2 Device\r\niPhone 5S 9.3.5 Device\r\nMac OSX El Capitan 10.11.6\r\nTi SDK: 6.0.0.v20160929031439\r\nAppc Studio: 4.8.0.201609232005\r\nAppc NPM: 4.2.8-7\r\nApp CLI: 6.0.0-54\r\nXcode 8.0 \r\nNode v4.4.7\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-09-29T16:53:19.000+0000", "updated": "2016-09-29T16:53:19.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }