Multicolumn ListView helper library
This module allows you to implement multicolumn ListView with the Appcelerator Titanium SDK.
It uses the Titanium ListView.
Download the latest distribution ZIP-file and consult the Titanium Documentation on how install it, or simply use the gitTio CLI:
$ gittio install com.falkolab.lvmc
This module uses and wrap the Ti.UI.ListView API.
The ListView object extended by these custom parameters:
columnsnumber (creation only) - sets the maximum columns count in sections
The ListSection object extended by these custom parameters:
columnsnumber (creation only) - sets the exact columns count for this section. Must be equal or less than same parameter of ListView.defaultItemTemplatestring (creation only) - default template for items. Must be defined if you definecolumns.
You must call transformEvent function if you want to get itemIndex, bindId, firstVisibleItemIndex, visibleItemCount, firstVisibleItem from property.
Example #1:
list.addEventListener('itemclick', function(evt) {
require('com.falkolab.lvmc').transformEvent(evt);
alert('`itemclick` event:\n'+ JSON.stringify(_.omit(evt, 'source', 'section'), null, '\t'));
});
Example #2:
list.addEventListener('itemclick', function(evt) {
require('com.falkolab.lvmc').transformEvent(evt);
// no need to wrap section if you use `transformEvent`
var dataItem = evt.section.getItemAt(evt.itemIndex);
...
evt.section.updateItemAt(evt.itemIndex, dataItem);
}
You can use similar helper methods from this library like ListView/ListSection but place list or section instance as first parameter.
Look at the docs but use ListView instance as first argument. Titanium.UI.ListView.
Supported helpers: appendSection, setMarker, addMarker
Example:
var lvmc = require('com.falkolab.lvmc');
lvmc.setItems(section, items);
Or use wrapper:
section = lvmc.wrap(section)
section.setItems(items);
section = null;
Look at the docs but use ListSection instance as first argument. Titanium.UI.ListSection.
Supported helpers: setItems, getItems, getItemAt, appendItems, insertItemsAt, replaceItemsAt, deleteItemsAt, updateItemAt
You must not use section.items property if you define columns for it. Use lvmc.setItems instead. Look at example above.
- Different templates for items in same multicolumn section.
- Several sections with different columns amount.
- Add, replace, insert, delete etc items from multicolumn section.
- Use single column and multicolumn sections same time.
You can't:
- ?
For additional info please Look at demo applications:
MIT
Copyright 2016 Andrey Tkachenko aka falkolab

