Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27142] iOS 13 : Multiple row selection in ListView

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2019-08-30T16:39:26.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.2.0
Componentsn/a
Labelsn/a
ReporterVijay Singh
AssigneeVijay Singh
Created2019-06-09T07:26:51.000+0000
Updated2020-11-20T09:02:21.000+0000

Description

In iOS 13 apple has exposed some new APIs to support multiple row selection using two-finger gesture in tableview. Expose this behavior. See APIs - https://developer.apple.com/documentation/uikit/uitableviewdelegate/3183943-tableview?language=objc, https://developer.apple.com/documentation/uikit/uitableviewdelegate/3183942-tableview?language=objc and https://developer.apple.com/documentation/uikit/uitableviewdelegate/3183944-tableviewdidendmultipleselection?language=objc

Comments

  1. Vijay Singh 2019-06-21

    PR - https://github.com/appcelerator/titanium_mobile/pull/10989 Test Case (Ti.UI.ListView) -
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
        
       var nav = Ti.UI.createNavigationWindow({ 
         window: win,
        });
        
        var items = [];
        for (var i = 0; i < 20; i++) {
           items.push({
                   properties: {
                       title: 'Item ' + i,
                       canEdit: true,
                   }
               });
         }
        
       var list = Ti.UI.createListView({
           allowsMultipleSelectionDuringEditing: true,
           allowsMultipleSelectionInteraction: true,
           sections: [Ti.UI.createListSection({
                       items: items
                   })]
       })
        
        list.addEventListener('itemclick', function(e) {
           Ti.API.info('click at index: ' + e.itemIndex); 
       })
        
        list.addEventListener("delete", function(e){
           Ti.API.info("Deleted Row Index is is: " +e.itemIndex);
           Ti.API.info("Deleted Section Index is is: " +e.sectionIndex);
        
        });
        
         list.addEventListener("itemsselected", function(e){
           Ti.API.info("Selected  Item count is: " +e.selectedItems.length);
        
        
         var dialog = Ti.UI.createAlertDialog({
           buttonNames: ['Change Color', 'Cancel'],
           message: 'Would you like to change title color of selected rows?',
         });
        
         dialog.addEventListener('click', function(f) {
           if (f.index === 1) {
             list.editing = false;
           } else {
               for (var i = 0; i < e.selectedItems.length; i++) { 
                   var rowObject = e.selectedItems[i];
                   var item = rowObject.section.getItemAt(rowObject.itemIndex)
                   item.properties.color = 'green';
                   rowObject.section.updateItemAt(rowObject.itemIndex, item);
               }
               list.editing = false;
           }
         });
        dialog.show();
        
       });
        
       win.add(list);
       nav.open();
       
    Test Case (Ti.UI.TableView) -
       var rows = [];
       for (var i = 0; i < 20; i++) {
           rows.push({ title: 'Row '+ i, editable: true});
       }
       var win = Ti.UI.createWindow({
         title: 'TEST',
         backgroundColor: '#ffffff',
       });
        
       var nav = Ti.UI.createNavigationWindow({ 
         window: win,
        });
        
        
       var lv = Ti.UI.createTableView({
           data: rows,
           allowsMultipleSelectionDuringEditing : true,
           allowsMultipleSelectionInteraction: true
       });
        
       lv.addEventListener("rowsselected", function(e){
         Ti.API.info("Selected  Row count is: " +e.selectedRows.length);
        
         var dialog = Ti.UI.createAlertDialog({
           buttonNames: ['Change color', 'Cancel'],
           message: 'Would you like to change text color of selected rows?',
         });
        
         dialog.addEventListener('click', function(f) {
           if (f.index === 1) {
             Ti.API.info('The cancel button was clicked');
             lv.editing = false;
           } else {
               Ti.API.info('The delete button was clicked');
               for (var i = 0; i < e.selectedRows.length; i++) {
                   var rowObject = e.selectedRows[i]; 
                   rowObject.row.color = 'green'
               }
               lv.editing = false;
           }
         });
         dialog.show();
       });
        
       win.add(lv);
       nav.open();
       
  2. Keerthi Mahalingam 2019-08-16

    FR passed. waiting on Jenkins to merge
  3. Samir Mohammed 2019-08-23

    [~vijaysingh] please could you add a PR for 8_3_X?
  4. Lokesh Choudhary 2019-08-28

    [~kmahalingam], We dont need to merge this PR to 8.3.0 as we will be merging 8.3.0 to 8.2.0 later.
  5. Christopher Williams 2019-08-29

    merged to master (8.2.0)
  6. Keerthi Mahalingam 2019-08-30

    Verified the fix on sdk 8.2.0.v20190829124255.able to select multiple rows.Closing Test Environment: Name = Mac OS X Version = 10.14.5 Architecture = 64bit # CPUs = 12 Memory = 17179869184 Node.js Node.js Version = 10.16.2 npm Version = 6.9.0 Titanium CLI CLI Version = 5.2.1 Titanium SDK SDK Version = 8.2.0.v20190829124255 Device =iPhone XR iOS 13 Simulator- iPhone 8 plus iOS 13

JSON Source