Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8998] Android: UI.TableView and TableViewRow - add editing and moving modes and editable and moveable properties

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-10T18:07:04.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsparity
ReporterPaul Dowsett
AssigneeUnknown
Created2012-05-04T14:00:23.000+0000
Updated2020-11-06T01:51:59.000+0000

Description

Problem

On iOS, a tableview can be set to editing and/or moving modes, which allow the user to delete or re-order rows respectively. To provide parity, implement this functionality for Android. See attached image for an example. See [Titanium.UI.TableView](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.TableView) documentation for the current iOS behavior.

Test case

This code may be used for testing different combinations of editing/moving and editable/moveable (inherited and explicit) properties. Enable landscape mode to see the full text of each row.
Ti.UI.setBackgroundColor('#ddd');
var win = Ti.UI.createWindow({
	title:'TableView Edit and Move Demo',
	layout:'vertical'
});

var button = Ti.UI.createButton({
	title:'Edit',
	right: 10, top:10,
	width:100, height:50
});
win.add(button);

var data = [
	{title:'1. Inherit edit, Inherit move'},
	
	{title:'2. Inherit edit, explicit move true', moveable:true},
	{title:'3. Inherit edit, explicit move false', moveable:false},
	{title:'4. Explicit edit true, Inherit move', editable:true},
	{title:'5. Explicit edit false, Inherit move', editable:false},
	
	{title:'6. Explicit edit true, explicit move true', editable:true, moveable:true},
	{title:'7. Explicit edit true, explicit move false', editable:true, moveable:false},
	{title:'8. Explicit edit false, explicit move true', editable:false, moveable:true},
	{title:'9. Explicit edit false, explicit move false', editable:false, moveable:false}
];

var tableview = Ti.UI.createTableView({
	backgroundColor:'white',
	data:data,
	editable:true,
	moveable:false,
	top:10
});

win.add(tableview);

var isTableModifiable = false;

button.addEventListener('click', function(e){
	if(isTableModifiable){
		// exit edit/move mode
		e.source.title = 'Edit';
		tableview.moving = false;
		tableview.editing = false;
	} else {
		// enter edit/move mode
		e.source.title = 'Cancel';
		tableview.moving = true;
		tableview.editing = true;		
	}
	isTableModifiable = !isTableModifiable;
});

win.open();

Attachments

FileDateSize
iOS Simulator.png2012-05-04T14:06:20.000+000050480

Comments

  1. Thomas Neerup 2015-11-04

    Any chance this will ever be implemented ?
  2. Alan Hutton 2020-01-10

    This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source