Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 1.81 KB

README.md

File metadata and controls

65 lines (51 loc) · 1.81 KB

Deprecation Notice

10/12/15 -- This library is very old and no longer maintained.

Sortable Grid View for Titanium

Sortable. Movable. Drag and Droppable.

Make a sortable grid using Titanium controls. Inspired by various Q&A posts. Uses Pedro Enrique's excellent TiDraggable module.

Use

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		
});

All Properties

  • data: array of views that will become the cells in your list/grid
  • cellWidth/cellHeight: size of cell in pixels
  • columnPadding: Space between columns
  • rowPadding: Space between rows
  • columns: Number of columns

Todos

  • Write the todos list

License

Copyright (c) 2013 Adam Paxton - Polanco Media, LLC
http://github.com/adampax/TiSortable
Licensed under the MIT License. See License.txt