Re: [Proto-Scripty] Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 22:37, Richard Quadling  wrote:
> On 2 July 2010 11:22, Alex McAuley  wrote:
>> But richard... Font sizes and styles aside... the span with the largest
>> amount of text will still be the widest and vice versa!!...
>>
>> ABCDEFG is still wider than ABCDE no matter the font size!!
>>
>> Alex Mcauley
>> http://www.thevacancymarket.com
>> - Original Message - From: "Richard Quadling" 
>> To: 
>> Sent: Thursday, July 01, 2010 11:57 PM
>> Subject: Re: [Proto-Scripty] Sorting some spans.
>>
>>
>>> On 1 July 2010 21:28, Alex McAuley 
>>> wrote:

 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
 ...
>>>
>>> The widths are dependent upon the font, size and styling being used,
>>> not under my control.
>>>
>>> The size of the display isn't under my control.
>>>
>>> So all of this is done in realtime on the client. Chrome is WAY the
>>> fastest in this and is not really noticeable.
>>>
>>> IE and FF are quite slow, but I've not yet optimized the code.
>>>
>>> So once the client has tidied the display, I know how many columns I
>>> can have to fill.
>>>
>>> The example I provided is dummy data and without the JS to do the calc.
>>>
>>> I'm stuck on the algorithm for sorting the data the way I want. I can
>>> see that I need to tag the spans if I want to sort them, but I can't
>>> work out what the sort mechanics need to be.
>>>
>
> W is a LOT wider than an i
>
>
> And if they style this in a narrow font, I may get 8 columns. If they
> style with additional images (flags, logos, etc.), then the width is
> very much different.
>

A real example from one of the data sets.

Hill Hire
ASDA

OK, Hill Hire _is_ wider than ASDA, but only just, yet has more than
twice the number of characters.

-- 
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.



Re: [Proto-Scripty] Re: Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 09:34, T.J. Crowder  wrote:
> Hi Richard,
>
>> I've got a  containing a set of 
>> sort of thing.
>
> OT, and not to throw a spanner in, but I assume if you're doing that,
> you have an ID on every checkbox and a `for` on every label (so the
> labels know what checkbox they relate to). You can avoid that and
> ditch the span as well:
>
>    Label text
>
> That will automatically associate the label with the checkbox, no IDs
> or `for`s required.
>
> Re the sorting:
>
>> So once the client has tidied the display, I know how many columns I
>> can have to fill.
>
> Do you know this before you create the grid? Or do you have to create
> the grid before you know how many columns you have, and *then* sort
> it?
>
> -- T.J. :-)

I don't create a real grid/table. I'm just using left floats with
fixed width spans (and I'll be changing that to the embedded cbs in
labels - thanks).

-- 
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.



Re: [Proto-Scripty] Sorting some spans.

2010-07-02 Thread Richard Quadling
On 2 July 2010 11:22, Alex McAuley  wrote:
> But richard... Font sizes and styles aside... the span with the largest
> amount of text will still be the widest and vice versa!!...
>
> ABCDEFG is still wider than ABCDE no matter the font size!!
>
> Alex Mcauley
> http://www.thevacancymarket.com
> - Original Message - From: "Richard Quadling" 
> To: 
> Sent: Thursday, July 01, 2010 11:57 PM
> Subject: Re: [Proto-Scripty] Sorting some spans.
>
>
>> On 1 July 2010 21:28, Alex McAuley 
>> wrote:
>>>
>>> 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
>>> ...
>>
>> The widths are dependent upon the font, size and styling being used,
>> not under my control.
>>
>> The size of the display isn't under my control.
>>
>> So all of this is done in realtime on the client. Chrome is WAY the
>> fastest in this and is not really noticeable.
>>
>> IE and FF are quite slow, but I've not yet optimized the code.
>>
>> So once the client has tidied the display, I know how many columns I
>> can have to fill.
>>
>> The example I provided is dummy data and without the JS to do the calc.
>>
>> I'm stuck on the algorithm for sorting the data the way I want. I can
>> see that I need to tag the spans if I want to sort them, but I can't
>> work out what the sort mechanics need to be.
>>

W is a LOT wider than an i


And if they style this in a narrow font, I may get 8 columns. If they
style with additional images (flags, logos, etc.), then the width is
very much different.

-- 
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.



Re: [Proto-Scripty] Sorting some spans.

2010-07-02 Thread Alex McAuley
But richard... Font sizes and styles aside... the span with the largest 
amount of text will still be the widest and vice versa!!...


ABCDEFG is still wider than ABCDE no matter the font size!!

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Richard Quadling" 

To: 
Sent: Thursday, July 01, 2010 11:57 PM
Subject: Re: [Proto-Scripty] Sorting some spans.


On 1 July 2010 21:28, Alex McAuley  
wrote:
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

...


The widths are dependent upon the font, size and styling being used,
not under my control.

The size of the display isn't under my control.

So all of this is done in realtime on the client. Chrome is WAY the
fastest in this and is not really noticeable.

IE and FF are quite slow, but I've not yet optimized the code.

So once the client has tidied the display, I know how many columns I
can have to fill.

The example I provided is dummy data and without the JS to do the calc.

I'm stuck on the algorithm for sorting the data the way I want. I can
see that I need to tag the spans if I want to sort them, but I can't
work out what the sort mechanics need to be.

--
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.



[Proto-Scripty] Re: Sorting some spans.

2010-07-02 Thread T.J. Crowder
Hi Richard,

> I've got a  containing a set of 
> sort of thing.

OT, and not to throw a spanner in, but I assume if you're doing that,
you have an ID on every checkbox and a `for` on every label (so the
labels know what checkbox they relate to). You can avoid that and
ditch the span as well:

Label text

That will automatically associate the label with the checkbox, no IDs
or `for`s required.

Re the sorting:

> So once the client has tidied the display, I know how many columns I
> can have to fill.

Do you know this before you create the grid? Or do you have to create
the grid before you know how many columns you have, and *then* sort
it?

-- T.J. :-)

On Jul 1, 11:57 pm, Richard Quadling  wrote:
> On 1 July 2010 21:28, Alex McAuley  wrote:
>
> > 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
> > ...
>
> The widths are dependent upon the font, size and styling being used,
> not under my control.
>
> The size of the display isn't under my control.
>
> So all of this is done in realtime on the client. Chrome is WAY the
> fastest in this and is not really noticeable.
>
> IE and FF are quite slow, but I've not yet optimized the code.
>
> So once the client has tidied the display, I know how many columns I
> can have to fill.
>
> The example I provided is dummy data and without the JS to do the calc.
>
> I'm stuck on the algorithm for sorting the data the way I want. I can
> see that I need to tag the spans if I want to sort them, but I can't
> work out what the sort mechanics need to be.

-- 
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.