Item Rendering for aTo-Many Relation

For displaying a list of itmes, such as tasks or to report item prices per day, such as:

            Widget A   Widget B
2010-Mar-27    $1.25      $2.55
2010-Mar-26    $1.35      $2.56
2010-Mar-25    $2.02      $2.57
2010-Mar-24    $1.99      $2.50
2010-Mar-23    $1.65      $2.49

Magritte seems quite the ticket, simply create an object to hold the daily price, and another object which has the collection - the first has a description for each widget, the second has a MAToManyRelationDescription for the collection. Unfortunately, the ordering is a little difficult because adding an item will place it on the end (its preferable to add it to the front of the collection). One simple way to make it do this is to have the model return a SortedCollection, as in:

SortedCollection sortBlock: [:a :b | a date > b date]

Comment if you see an easier/better solution.

Posted by John Borden at 11 August 2014, 11:26 am link