{ "id": "63787", "key": "TIMOB-3155", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11246", "name": "Sprint 2011-11", "archived": true, "released": true, "releaseDate": "2011-03-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:01:03.000+0000", "created": "2011-04-15T03:38:10.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "feature", "release-1.7.0", "reported-1.5.1", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:01:03.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": "{html}

See Helpdesk\n73731

{html}", "attachment": [ { "id": "18269", "filename": "app.js", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:38:11.000+0000", "size": 722, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: Tableview missing scrollToTop method", "creator": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130167", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Note that scrollToIndex(), which works on android\nwithout issue, can in some cases be used as a substitute for\nscrollToTop().

\n

In case you need it, the following simple usecase reproduces the\nissue for scrollToTop():

\n
\nvar win = Ti.UI.createWindow({\n    backgroundColor: 'white',\n    exitOnClose:true\n});\n\nvar data = [];\n\nfor(var i=0;i<25;i++){\n    Ti.API.info('Loop iteration '+i);\n    var thisRow = Ti.UI.createTableViewRow({\n        title:'Row '+i\n    });\n    \n    data.push(thisRow);\n    \n    if(i === 24){\n        thisRow.addEventListener('click', function(){\n            tableview.scrollToTop(0,{animated:true});\n        });\n    }\n}\n\n\nvar tableview = Ti.UI.createTableView({\n    data:data\n});\n\ntableview.addEventListener('click', function(e)\n{\n    // event data\n    var index = e.index;\n    var row = e.row;\n    var rowdata = e.rowData;\n    Ti.API.info('Table View: row = ' + row + ', index = ' + index);\n});\n\nwin.add(tableview);\nwin.open();\n
\n

This produces the following exception:

\n
\n  762         KeyCharacterMap  W  No keyboard for id 0\n  762         KeyCharacterMap  W  Using default keymap: /system/usr/keychars/qwerty.kcm.bin\n  762           KrollCallback  E  (kroll$1) [63461,66611] ECMA Error evaluating source, invocation: [callMethod UI.TableViewRow.UI.TableVi\n                                  ewRow:event:click null], message: TypeError: Cannot find function scrollToTop in object [Ti.UI.TableView\n                                  ]. (app://app.js#70)\n  762           KrollCallback  E  org.mozilla.javascript.EcmaError: TypeError: Cannot find function scrollToTop in object [Ti.UI.TableView\n                                  ]. (app://app.js#70)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3761)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3739)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3767)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3786)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3850)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2343)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310)\n  762           KrollCallback  E    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1524)\n  762           KrollCallback  E    at script(app://app.js:70)\n  762           KrollCallback  E    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)\n  762           KrollCallback  E    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)\n  762           KrollCallback  E    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)\n  762           KrollCallback  E    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)\n  762           KrollCallback  E    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)\n  762           KrollCallback  E    at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:132)\n  762           KrollCallback  E    at org.appcelerator.titanium.kroll.KrollCallback$1.run(KrollCallback.java:156)\n  762           KrollCallback  E    at android.os.Handler.handleCallback(Handler.java:587)\n  762           KrollCallback  E    at android.os.Handler.dispatchMessage(Handler.java:92)\n  762           KrollCallback  E    at android.os.Looper.loop(Looper.java:123)\n  762           KrollCallback  E    at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)\n  762               TiContext  E  (kroll$1) [17,66628] Rhino Error: app://app.js:70,0\n  762               TiContext  E  (kroll$1) [4,66632]  Message: TypeError: Cannot find function scrollToTop in object [Ti.UI.TableView]. (\n                                  app://app.js#70)\n  762               TiContext  E  (kroll$1) [8,66640]  Source: null\n
{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:11.000+0000", "updated": "2011-04-15T03:38:11.000+0000" }, { "id": "130168", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Note, the user has provided a good explanation of why this would\nbe useful, and how the functionality works on iOS:

\n

\"The scenario goes like this: I have a tableviewrow with a\ntextfield in it. When the textfield receives focus, the keyboard\nslides up and hence I need that row to slide up as well and be\nvisible. I could do this on the iPhone using scrollToTop.\nScrollToIndex only makes sure that the row with the given index is\nvisible on screen. However, it does not take the keyboard sliding\ninto consideration. Hence, even though the row is technically\nvisible, it could be still be hidden behind the keyboard.\"

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:11.000+0000", "updated": "2011-04-15T03:38:11.000+0000" }, { "id": "130169", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

(from [e49e01936563ad375adbaa9db28ed86696e1638c])\n[#3155 state:fixed-in-qa] added scrollToTop\nmethod for Table View

\n

Added scrollToTop method for Table View in Android
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/e49e01936563...

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:38:13.000+0000", "updated": "2011-04-15T03:38:13.000+0000" }, { "id": "130170", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

Please verify fix with attached app.js. If you click on row 5,\nyou should see row 13 scroll to the top of the table view.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:38:13.000+0000", "updated": "2011-04-15T03:38:13.000+0000" }, { "id": "130171", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/17/11 10:02 630a276)\non
\niPad 4.3
\nSimulator 4.1
\niPhone4 4.3
\nClicking on row 5 just slightly moves it does not bring row 13 to\ntop

\n

Tested with Titanium SDK version: 1.7.0 (03/17/11 10:02 630a276)\non
\nNexus S 2.3.2 puts row 13 into the viewable area but not to top
\nEmulator 2.1 puts row 13 to top
\nEmulator 2.1 WVGA800 puts row 13 into the viewable area but not to\ntop

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:13.000+0000", "updated": "2011-04-15T03:38:13.000+0000" }, { "id": "130172", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/17/11 10:02 630a276)\non
\nNexus S 2.3.2 puts row 13 into the viewable area but not to top ---\nThe screen is high density so it can display a lot more in the\nview, and having only 24 items bringing 13 to the top will cause\nwhite space below which is not allowed. Modifying the test to\nconsist of 45 works as expected.

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:15.000+0000", "updated": "2011-04-15T03:38:15.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }