{ "id": "61847", "key": "TIMOB-1215", "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": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11247", "name": "Sprint 2011-12", "archived": true, "released": true, "releaseDate": "2011-03-28" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-26T09:15:06.000+0000", "created": "2011-04-15T02:46:47.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect", "reported-1.3.2", "rows", "tableview" ], "versions": [], "issuelinks": [], "assignee": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-26T09:15:06.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}

Platform: Android, emulator, Ti 1.3.2

\n

Ti.UI.TableView.data.length returns the original no of rows in\ntable, rather than current number of rows

\n

A good example of this problem is in the KitchenSink at \ntable_view_row_delete.js which results in an exception after\nrow 5 is deleted, because tableview.data.length-1 on line 52 always\nreturns 4 (and after row 5 is deleted, id 4 no longer exists).

\n

Inserting this code at line 49 and opening the delete row page\nwill make the problem clear:

\n

Ti.API.info(' * * * * * * * * * * * * ');
\nTi.API.info(typeof(tableview));
\nTi.API.info(typeof(tableview.data));
\nTi.API.info(typeof(tableview.data.length));
\nTi.API.info('Number of table rows: '+tableview.data.length);
\ntableview.deleteRow(tableview.data.length-1);
\nTi.API.info(\"deleting row\");
\nTi.API.info('Number of table rows: '+tableview.data.length);
\nTi.API.info(' * * * * * * * * * * * * ');

\n

Incidentally, another issue that may be related is that\ngetData() does not work currently, demonstrated by\nTi.API.info('getData type: '+typeof(tableview.getData()));\nproducing an exception.

{html}", "attachment": [], "flagged": false, "summary": "Ti.UI.TableView.data.length returns the original no of rows in table, rather than *current* number of rows", "creator": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "environment": null, "comment": { "comments": [ { "id": "125084", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

See \nhttp://developer.appcelerator.com/question/39391/kitchensink-tablev...\nfor better formatting of the code!

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:47.000+0000", "updated": "2011-04-15T02:46:47.000+0000" }, { "id": "125085", "author": { "name": "lukemelia", "key": "lukemelia", "displayName": "Luke Melia", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I think that I'm seeing this on iPhone 1.4, too. Is there\nanother way to get the number of rows in the table?

{html}", "updateAuthor": { "name": "lukemelia", "key": "lukemelia", "displayName": "Luke Melia", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:48.000+0000", "updated": "2011-04-15T02:46:48.000+0000" }, { "id": "125086", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Actually, I don't think javascript inherently returns the\ncorrect array.length when an element has been removed, because I\ndon't think elements of an array can be deleted - they can only be\nnulled. After this, the array remains the same length as when it\nwas created.

\n

Still, as I imagine Ti manages the number of visible rows\ndisplayed in a table as an object, hopefully there is a better way\nof obtaining this information than with array.length.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:48.000+0000", "updated": "2011-04-15T02:46:48.000+0000" }, { "id": "125087", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Gonna reassign to Don for triage. Sorry Don!

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:49.000+0000", "updated": "2011-04-15T02:46:49.000+0000" }, { "id": "125088", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Has this issue been resolved?

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:49.000+0000", "updated": "2011-04-15T02:46:49.000+0000" }, { "id": "125089", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Joe

\n

As this ticket is not marked resolved, the issue has not been\nresolved.

\n

Note that this system is not the place for a discussion - ask a\nquestion in the Q&A\nif you are looking for suggestions for a workaround.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:49.000+0000", "updated": "2011-04-15T02:46:49.000+0000" }, { "id": "125090", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This ticket is now invalid. Tableview.data returns an array of\nSections. You can iterate that array and sum the rows in all\nsections.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:50.000+0000", "updated": "2011-04-15T02:46:50.000+0000" }, { "id": "125091", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Example:

\n

Don is right, to see an example of how this works, check out\nthis post on the Q&A Forum: \nNumber of Rows in Table

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:50.000+0000", "updated": "2011-04-15T02:46:50.000+0000" }, { "id": "125092", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Joe

\n

I am certain that everyone appreciates your participation, which\nis welcome and worthwhile. That said, the medium you are choosing\nto give it is not really appropriate.

\n

As Don is the lead for the Titanium Android development team,\nhis posts to Lighthouse should typically be considered the\ndefinitive view at the time of writing of any issue.

\n

Bear in mind that the Q&A is a community forum, and hence\nthe views expressed in it are provided on a best-effort basis. As\nsuch, there is little point using advice provided in the Q&A to\njustify a standpoint made in Lighthouse.

\n

Again, Lighthouse is not the place for discussion, speculation\nor opinion, which simply create noise and interrupt work on the\ntask at hand.

\n

Even by writing this post I realize I risk contributing to that\nnoise, but I hope it will be sufficient to encourage you to keep\nall of your posts strictly factual while always providing sound\nevidence to support them.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:46:51.000+0000", "updated": "2011-04-15T02:46:51.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }