1.4.0
Support for any data type in the Picker items array
Where the Picker previously only accepted an array of strings it can now deal with any kind of item. This is especially convenient when handling an item in the select
and change:selection
events.
By default the Picker calls toString()
on the item to convert it to string, but you can also provide a custom function to do this in the new itemText
property:
tabris.create("Picker", {
items: airports,
itemText: function(airport) {
return airport.name;
}
});
Scroll event for CollectionView
Just like in ScrollView, CollectionView now has a scroll
event that lets you know when the user has scrolled. The callback contains information about the scrolling direction and distance.
New "firstVisibleIndex" and "lastVisibleIndex" properties in CollectionView
To determine which items are currently visible on screen the firstVisibleIndex
and lastVisibleIndex
properties have been added to CollectionView. These also come with matching change events, which are very well suited to implement an "endless scrolling list". Simply listen to "change:lastVisibleIndex" and start loading more items once the value exceeds a limit of your choosing.