Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7735] iOS: Support Insert style rows in TableViews

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-10-28T22:33:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.2.0
ComponentsiOS
Labelsinsert, listview
ReporterEvan Borgstrom
AssigneeHans Knöchel
Created2012-01-24T11:26:02.000+0000
Updated2016-01-14T21:18:37.000+0000

Description

iOS TableView objects already support delete style rows and supporting insert style rows is trivial.

Attachments

FileDateSize
Insert-Current-Results.png2012-01-24T11:26:02.000+000016423
Insert-Expected-Results.png2012-01-24T11:26:02.000+000016413

Comments

  1. Ritu Agrawal 2014-01-01

    TC-2892 has been resolved as a duplicate of this ticket but it contains useful information and a pull request that would be useful in the context of this ticket. Blog post: http://blog.codexlabs.com/blog/2013/08/31/uitableviewcelleditingstyleinsert-is-now-a-pull-request-for-titanium-mobile/ Community pull request: https://github.com/appcelerator/titanium_mobile/pull/4636 Q&A Discussion: https://developer.appcelerator.com/question/140226/add-row-row-in-editable-tableview
  2. Andrew McElroy 2014-07-08

    it seems like the momentum on this is dead. This API is still current in iOS7 and there's no indication that iOS8 will deprecate it: https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html Maybe at this point it would make more sense to just wrap the SWTableViewCell repo on github: https://github.com/CEWendel/SWTableViewCell
  3. Hans Knöchel 2015-10-27

    We will not support the insert style on the legacy Ti.UI.TableView, but provide a solution for the usage inside the Ti.UI.ListView now. PR: https://github.com/appcelerator/titanium_mobile/pull/7355 Demo code:
       var isEditing = false;
        
       var btn = Ti.UI.createButton({
           title: "Edit"
       });
       var win = Ti.UI.createWindow({
           rightNavButton: btn
       });
       var nav = Ti.UI.iOS.createNavigationWindow({window:win});
       var list = Ti.UI.createListView();
        
       var section = Ti.UI.createListSection({
           items: [{
               properties: {
                   title: "Removeable Cell",
                   canEdit: true
               }
           },{
               properties: {
                   title: "Insertable Cell",
                   canInsert: true
               }
           }]
       });
        
       list.addEventListener("delete", function(e) {
           Ti.API.warn("Delete");
           Ti.API.warn(e);
       })
        
       list.addEventListener("insert", function(e) {
           Ti.API.warn("Insert");
           Ti.API.warn(e);
        
           e.section.insertItemsAt(e.itemIndex+1, [
               {
                   properties: {
                       title: "New Cell"
                   }
               }
           ], {
               animationStyle: Ti.UI.iPhone.RowAnimationStyle.TOP
           });
       });
        
       btn.addEventListener("click", function() {
           isEditing = !isEditing;
        
           btn.setTitle(isEditing ? "Done" : "Edit");
           list.setEditing(isEditing);
       })
        
       list.setSections([section]);
        
       win.add(list);
       nav.open();
       
  4. Josh Longton 2016-01-14

JSON Source