[Seaside] Displaying items from a dictionary collection in a
leves at elte.hu
Sat Oct 23 22:30:02 UTC 2010
On Sat, 23 Oct 2010, Gilles Schtickzelle wrote:
> I have a seaside component that I use to display a list of items pulled from
> a dictionary.
> They appear to be in random order and I'd like to have them displayed in
> alphabetical or reverse alphabetical order.
> I don't really want to have an intermediary orderedCollection that I would
> display instead, as I would like to add to and delete items from the
> dictionary directly and see the changes in the component without having to
> repopulate the intermediary collection.
> Is that any way to do that?
If you have enough the time to render the full contents of the dictionary,
then you probably have the time to create a sorted copy of the dictionary
and render that. Your component will have to apply the updates to the
If you render the full contents only once and update the list via ajax or
websockets then do the sorting/inserting/removing in the browser and only
the updates on the server side.
If you don't render the full contents, then:
- if updates are infrequent, then you can cache the sorted values and use
that for rendering
- if the updates are frequent, then you better use a tree based dictionary
implementation. This option will work all the time as long as the keys
give the sort order.
More information about the seaside