Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19253] iOS: Clicking a list item while editing the list does not fire itemclick event

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-05-13T20:52:30.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsqe-5.4.0
ReporterBe Rushton
AssigneeAngel Petkov
Created2015-07-24T05:34:13.000+0000
Updated2016-06-22T17:11:29.000+0000

Description

Test code:
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var listViewEditing = false;
var listView = Ti.UI.createListView({editing: listViewEditing, height: 100, top: 20});
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    {properties: { title: 'Apple', canEdit: true}},
    {properties: { title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

listView.sections = sections;

listView.addEventListener('itemclick', function() {
	alert("itemclick");
	// BUG: this only fires when listView.editing is false
});

win.add(listView);

var button = Ti.UI.createButton({title: "Toggle editing"});
button.addEventListener('click', function() {
	listViewEditing = !listViewEditing;
	listView.editing = listViewEditing;
});
win.add(button);

win.open();

Comments

  1. Be Rushton 2016-05-06

    Anyone going to look at this?
  2. Chee Kiat Ng 2016-05-10

    [~morahman] did you check this out on tableview? [~apetkov] can do some research here. But from what I know, I think for iOS in edit mode, natively, it's not possible to fire an item click event, but instead it enters a mode where you can select files. If so, the docs may need some additional instructions.
  3. Sharif AbuDarda 2016-05-10

    Hello [~cng], I have tested in tableview. I see this is also happening for tableview. Tableview click event does not fired with "editing : true" in tableview.
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow();
       
       var tableData = [{
           title : 'Apples'
       }, {
           title : 'Bananas'
       }, {
           title : 'Carrots'
       }, {
           title : 'Potatoes'
       }];
       
       var table = Ti.UI.createTableView({
           data : tableData,
           editing : true
       });
       win.add(table);
       table.addEventListener('click', function() {
       
           alert("itemclick");
       
           // BUG: this only fires when TableView.editing is false
       
       });
       win.open(); 
       
    Regards, Sharif.
  4. Angel Petkov 2016-05-10

    On iOS theres a property called "AllowsSelectionDuringEditing" which is by default set to false. Introducing the property fixes the issues. PR: https://github.com/appcelerator/titanium_mobile/pull/7995/files
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow();
        
       var listView = Ti.UI.createListView({
       	headerTitle : "ListView",
       	height 	    : "50%", 
       	top         : 0, 
       	editing     : true,
       	allowsSelectionDuringEditing : true,
       });
        
       var sections = [];
        
       var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
       var fruitDataSet = [
           {properties: { title: 'Apple', canEdit: true}},
           {properties: { title: 'Banana', canEdit: true}},
           {properties: { title: 'Apple', canEdit: true}},
           {properties: { title: 'Banana', canEdit: true}},
           {properties: { title: 'Apple', canEdit: true}}, 
           {properties: { title: 'Banana', canEdit: true}}
              
       ];
       fruitSection.setItems(fruitDataSet);
       sections.push(fruitSection);
        
       listView.sections = sections;
        
       listView.addEventListener('itemclick', function() {
       	alert("itemclick");
       	// BUG: this only fires when listView.editing is false
       });
        
        
       var tableData = [{
           title : 'Apples'
       }, {
           title : 'Bananas'
       }, {
           title : 'Carrots'
       }, {
           title : 'Potatoes'
       }];
        
       var table = Ti.UI.createTableView({
       	headerTitle : "TableView",
           data  		: tableData,
           height 		: "50%",
           bottom 		: "0",
           editing 	: true,
           allowsSelectionDuringEditing : true
        
       });
        
       table.addEventListener('click', function() {
           alert("itemclick");
       });
       win.add(listView);
       win.add(table);
       win.open(); 
       
  5. Hans Knöchel 2016-05-10

    There already is this property for the Ti.UI.TableView: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-property-allowsSelectionDuringEditing So two things: - Remove the tableview-implementation from your PR, its a duplicate - Make sure the default behavior matches the iOS behavior - Provide default values in the setters [~bearus] Can you verify that PR works for you?
  6. Angel Petkov 2016-05-10

    Ah yeah i didn't see my bad, thanks. Updated the PR : * Removed the table view implementation * Renamed the list view implementation to mach the table view property. * Added default setters.
  7. Harry Bryant 2016-06-22

    Verified as fixed, ListView and TableViews can fire itemclick events during editing when allowsSelectionDuringEditing is set to true. The default when this property is not set is false. Tested On: iPhone 6S (9.3.2) Device Mac OSX El Capitan 10.11.5 Ti SDK: 5.4.0.v20160617074028 Appc Studio: 4.7.0.201606150733 Appc NPM: 4.2.7-2 App CLI: 5.4.0-18 Xcode 7.3 Node v4.2.6 *Closing ticket.*

JSON Source