Closed jamesladd closed 11 years ago
Set's are inherently unordered collections and should be used as such. The order of insertion should not be depended upon. See http://peter.michaux.ca/maria/api/maria.SetModel.html where it mentions that the order should not be depended upon.
There is almost always a more natural way to order elements in a set: time of creation, for example. You can ask the model for the elements of the array sorted and then use that array to update your view only changing changing elements of the SetView when elements of the sorted model array are different.
Alternatively one could write a ListModel class that is like a SetView but with defined ordering and methods to insert at particular points in the list. This would be very similar to https://github.com/petermichaux/maria-NodeModel/blob/master/src/NodeModel.js which is a node with ordered children designed to be a used in tree structures.
Another common difference between a set and a list: Usually a set can only contain an item once but a list can contain an item several times because each inclusion is at a different position in the list.
We have a Set and a SetView.
When we update an element in the Set it can change the order in which it should be displayed in the SetView.
The simple way we achieve this right now is to clear the Set and add the elements back in the order we require. However, this causes the SetView to 'flash' (View draws empty list, then draws list w entries).
How can we redraw / refresh the SetView without a 'flash' ?