10/12/15 -- This library is very old and no longer maintained.
Make a sortable grid using Titanium controls. Inspired by various Q&A posts. Uses Pedro Enrique's excellent TiDraggable module.
Require the CommonJS module
var SortableView = require('/path/to/SortableView');
Add some cell views to an array that will be passed to the SortableView
var data = [];
for (var i = 0; i < 9; i++){
var v = Ti.UI.createView({
backgroundColor: '#cdcdcd'
});
v.add(Ti.UI.createLabel({
text: 'Cell ' + (i+1),
color: '#3f3f3f',
font:{
fontSize:16,
fontWeight:'bold'
}
}));
data.push(v);
}
Create the SortableView and pass it the cell data
var view = new SortableView({
data: data, //array of views
cellWidth: 100,
cellHeight: 100,
columnPadding: 5, //Space in between two columns
rowPadding: 5, //Space in between two rows
columns: 3 //Number of columns
});
data:
array of views that will become the cells in your list/gridcellWidth
/cellHeight:
size of cell in pixelscolumnPadding:
Space between columnsrowPadding:
Space between rowscolumns:
Number of columns
- Write the todos list
Copyright (c) 2013 Adam Paxton - Polanco Media, LLC
http://github.com/adampax/TiSortable
Licensed under the MIT License. See License.txt