{ "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
\nTi.UI.TableView.data.length returns the original no of rows in\ntable, rather than current number of rows
\nA 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).
\nInserting this code at line 49 and opening the delete row page\nwill make the problem clear:
\nTi.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(' * * * * * * * * * * * * ');
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.
See \nhttp://developer.appcelerator.com/question/39391/kitchensink-tablev...\nfor better formatting of the code!
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?
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.
\nStill, 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.
Gonna reassign to Don for triage. Sorry Don!
Has this issue been resolved?
Joe
\nAs this ticket is not marked resolved, the issue has not been\nresolved.
\nNote 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.
This ticket is now invalid. Tableview.data returns an array of\nSections. You can iterate that array and sum the rows in all\nsections.
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
Joe
\nI 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.
\nAs 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.
\nBear 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.
\nAgain, Lighthouse is not the place for discussion, speculation\nor opinion, which simply create noise and interrupt work on the\ntask at hand.
\nEven 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.