If I was tackling this I would attach a class and id to the spans and select them all then find out all of the widths of each span as a number then sort them into high to low / low to high then redraw them all .. Prolly not the most efficient but it would work.

If you are using php you could do this without javascript based on strlen of the text that sits in the span and sort() / usort() the array then loop it ...



Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- From: "Richard Quadling" <rquadl...@gmail.com>
To: <prototype-scriptaculous@googlegroups.com>
Sent: Thursday, July 01, 2010 4:04 PM
Subject: [Proto-Scripty] Sorting some spans.


Hi.

I've got a <div> containing a set of <span><checkbox><label></span>
sort of thing.

Using some CSS and JS I've got all the checkboxes to line up in a grid
and it all looks very nice.

The labels are from a DB and are ordered alphabetically.

But when rendered, the list reads across and then down, rather than
down and then across.

e.g.

a b c d
e f g h
i j k l

rather than

a d g j
b e h k
c f i l

The grid (via the JS) auto sizes the spans to equally space the
elements. The number of columns is determined by the maximum size of
the labels, the size of the container and the screen size. None of
which is under my control, and therefore I'll never know up front how
many columns.

So, with that, is there a way to reorder the spans so they read in
columns first.

I've got a static mockup at http://pastebin.com/Sb5A83wh

Any ideas?

Regards,

Richard.

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.



--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to