{ "id": "171650", "key": "AC-5735", "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": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-05-14T15:19:54.000+0000", "created": "2018-05-14T09:16:34.000+0000", "labels": [ "ListView", "TextField", "scroll" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-05-14T15:20:00.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "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": "*Issue*\r\nLost value on scrolling down the ListView.\r\n\r\n*actual behavior*\r\n\r\n1. Compile and start on device\r\n2. Enter a text like \"Hello 123\"\r\n3. Scroll down and up again\r\n4. You read \"Hello\"\r\n\r\n*expected behavior*\r\n\r\n1. Compile and start on device\r\n2. Enter a text like \"Hello 123\"\r\n3. Scroll down and up again\r\n4. You read \"Hello 123\"", "attachment": [ { "id": "65156", "filename": "app.js", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-14T09:15:25.000+0000", "size": 2082, "mimeType": "application/javascript" } ], "flagged": false, "summary": "Android: TextField in ListView loses value on scroll (question)", "creator": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK version: 7.2.0.v20180511160139\r\nPlatform & version: Android 7.0\r\nDevice Details: Samsung Galaxy S6\r\nHost Operating System: Mac OS X 10.13.4\r\nAppc Version: 7.0.0\r\nTitanium CLI: 4.0.1\r\nNode version: v8.11.1", "comment": { "comments": [ { "id": "437610", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "When working with text-fields or text-areas in list-views, you need to persist the value in the list via {{updateItemAt}}, so the internal data structure gets updated as well. This is a common scenario when working with list-views and is happening both natively and in Titanium.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-14T09:46:13.000+0000", "updated": "2018-05-14T09:46:13.000+0000" }, { "id": "437611", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Agreed with above. To add to this, the reason it is happening is because items that re-enter the visible area are re-rendered. This is also why a ListView can have thousands of rows and not crash a low-end device.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-14T10:10:15.000+0000", "updated": "2018-05-14T10:10:15.000+0000" }, { "id": "437613", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for the feedback. I tried it out and I found a solution. Store text value on change event and update the textfield on scrollstart.\r\n\r\n*Store text value*\r\n\r\n{code:javacript}\r\nevents: {\r\n 'change': function(evt) {\t\t\t\t\t\t\r\n Ti.API.debug('change');\r\n textFieldValue = evt.value;\r\n },\r\n{code}\r\n\r\n*Update the textfield on scrollstart*\r\n\r\n{code:javacript}\r\nlist.addEventListener('scrollstart', function(e) {\r\n Ti.API.info('scrollstart');\r\n section.updateItemAt(1, {\r\n template: 'myNotes', \r\n myNotes: {\r\n value: textFieldValue,\r\n }\r\n });\r\n});\r\n{code}", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-14T12:16:13.000+0000", "updated": "2018-05-14T12:16:13.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }