sproutcore/sproutcore — pull request #1198 by publickeating (2014-03-29 03:15:38+00:00)
Title: Adds horizontal list rendering to SC.ListView

This is actually a very simple API addition that adds the `layoutDirection` property to SC.ListView so that a list can be rendered either vertically or horizontally. The API structure here is identical to what already exists in SC.SegmentedView for example and so it was easy to decide on.

The biggest challenge was to refactor SC.ListView and SC.CollectionRowDelegate to move away from height specific method and property names to more generic height or width (i.e. size) method and property names in a backwards compatible manner. However, all current properties/methods should work 100% and should provide messaging to help move to the new API which is as follows:

SC.CollectionRowDelegate:

itemHeight => rowSize
rowPadding => stays the same
rowSpacing => stays the same
rowHeight => rowSizePlusPadding (now readonly)
customRowHeightIndexes => customRowSizeIndexes
contentIndexRowHeight() => contentIndexRowSize()

SC.ListView:

rowHeightForContentIndex() => rowSizeForContentIndex()
rowHeightDidChangeForIndexes() => rowSizeDidChangeForIndexes()
rowOffsetForContentIndex() => stays the same

Other than support for renaming the properties, the actual changes in the code to support horizontal layout were surprisingly easy.

Thoughts on the new API naming?