Description
For TableViewRow whose movable property is set to false should not be rearrange if other movable rows try to drag above it. Similar functionality can be viewed in Iphone mail app in which "All Inboxes" row is always at the top, and other rows cannot be dragged above it. Please see the attached screenshot representing the same.
While in the below case movable rows are able to drag above the fixed row whose movable property is set to false. Please see the below code to reproduce the same:
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var data = [];
var row1 = Ti.UI.createTableViewRow({
title: 'Should be fixed',
moveable: false
});
var section1 = Ti.UI.createTableViewSection({
rows: [row1]
})
data.push(section1)
var row2 = Ti.UI.createTableViewRow({
title: 'Moveable 1',
moveable: true
});
var row3 = Ti.UI.createTableViewRow({
title: 'Moveable 2',
moveable: true
});
var section2 = Ti.UI.createTableViewSection({
rows: [row2, row3]
})
data.push(section2)
var tableView = Ti.UI.createTableView({
data:data,
moving: true,
moveable: false,
style: Titanium.UI.iPhone.TableViewStyle.GROUPED
})
win1.add(tableView);
tabGroup.addTab(tab1);
tabGroup.open();
cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0
The issue is reproducible with below environment: SDK: 3.0.0.GA , 3.0.2.GA , 3.1.0.GA , 3.1.1.v20130508001914 Studio: Appcelerator studio 3.1.1.201305072102 and Titanium studio 3.1.0.201304171607 Device : iOS simulator 6.0 The test code renders 3 tableviewrow. Top most has moveable property set to false.The rest two tableviewrow have moveable property set to true. Steps to reproduce: 1.Run the given sample app 2.Drag the 2nd and 3rd tableviewrow above the 1st tableviewrow Expected result 1.3 tableviewrow are displayed 2.The top tableviewrow should not move from its position. Actual result: 1.3 tableviewrow are displayed 2.The top tableviewrow moves from its position and the 2 tableviewrow get placed above it.
This is not a bug. The functionality that is being requested is controlled by the UITableViewDelegate method - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath We do not expose this functionality. In Titanium a movable row can be positioned anywhere in the tableView.
Closing