Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23341] Exception on iPhone: no row found for index. in -TiUITableViewProxy insertRowAfter

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-08-11T21:58:44.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsn/a
ReporterPeter Varadi
AssigneeAngel Petkov
Created2012-10-18T12:29:48.000+0000
Updated2017-03-22T17:12:19.000+0000

Description

When you are trying to add numerous rows to a TableView using insertRowAfter it randomly causes exceptions: "no row found for index. in -TiUITableViewProxy insertRowAfter:";" It looks line some code lines have been commented out for unknown reason and causing issues on the UI thread. Please see this commit: https://github.com/appcelerator/titanium_mobile/commit/040cb9ab4350e6f3bd6eb5e22770f76ec9791b5e And see this issue on the forum: http://developer.appcelerator.com/question/129708/obj-c-fix-for-error-on-tableview-insertrowbefore--insertrowafter This line should be back on those methods: ENSURE_UI_THREAD(insertRowAfter,args);

Comments

  1. Pedro Enrique 2013-04-02

    This is a very old commit. Please provide some code that we can test with
  2. Baharroth 2016-05-06

    Please reopen this ticket. The 'no row found for index' is still present in SDK 5.2. It's append when you use loop to insert row after the last row. Please check the answer and the explaination here https://archive.appcelerator.com/question/129708/obj-c-fix-for-error-on-tableview-insertrowbefore--insertrowafter
  3. Baharroth 2016-05-06

    And this is how to reproduce the bug
       var win = Ti.UI.createWindow();
       
       var tableData = [{
       	title : 'Apples'
       }, {
       	title : 'Bananas'
       }, {
       	title : 'Carrots'
       }, {
       	title : 'Potatoes'
       }];
       
       var table = Ti.UI.createTableView({
       	data : tableData
       });
       
       table.addEventListener("click", function(e) {
       	var currentIndex = e.index;
       	for (var i = 0; i < 5; i ++) {
       		table.insertRowAfter(currentIndex, Ti.UI.createTableViewRow({
       			title : 'test '  + i
       		}), {
       			animated : true,
       			animationStyle : Titanium.UI.iPhone.RowAnimationStyle.TOP
       		});
       	}
       });
       
       win.add(table);
       win.open();
       
    *EDIT by Hans*: Corrected the demo code and added some format.
  4. Hans Knöchel 2016-05-08

    Reopening ticket, this is a valid issue. PR: https://github.com/appcelerator/titanium_mobile/pull/7992
  5. Lee Morris 2017-03-22

    Closing ticket due to comments made above. Please re-open if this issue returns.

JSON Source