From: Gregor Kofler on
On 2010-01-31 00:04, Evertjan. wrote:

> "core library", terrible idea!

Terrible? Can you elaborate on that? Or is it just the name you don't like?

> Tables of "200 rows"?
>
> Those things should not be on a HTML page.
>
> Lasrge datacollections should be searched by search strings and prepared
> by serverside code and not scrolled foer visual search clientsidde.

*If* I have a table that large sorting makes sense. With 10 rows I don't
need sorting.

>> FF 3.5(a)Ubuntu 9.10 gives me on average 1,150ms with your solution and
>> 290ms with mine (even with the overhead of "fancy" sorting).
>>
>> Chromium 5.0(a)Ubuntu 9.10 *is* blazingly fast: 90ms for your solution -
>> 25ms for mine.
>>
>> Opera 10 45ms vs. 190ms.
>
> So what differense would that make on a talbe of max 20 rows, more is not
> accepable anyway.

Swapping whole row elements is just as simple *and* faster.

> You are just trying to confuse the issue. See above and ask the OP what
> he wants.

Hm, I always thought dorayme is a she... So far the OP hasn't said
anything about the size of her (or his) table.

Gregor
From: dorayme on
In article <hk2fi1$mu4$1(a)news.eternal-september.org>,
Gregor Kofler <usenet(a)gregorkofler.com> wrote:

> ... So far the OP hasn't said
> anything about the size of her (or his) table.

I have a lot of them of different lengths, not more than one to a
page, the biggest is not more than 200 rows.

I am still looking for a simple sorterer for just towns column
and striper combined. When I have more time I will work this one
out I guess, but if anyone has one that does *just this job*
really reliably, may I grab it please? I have posted a URL of the
sort of table.

http://dorayme.netweaver.com.au/tableSortCandidate.html

Necessary to know in any example is how *not* to have columns
sorted. The first col is towns (alphabetical), second is
postcodes, the rest are not to be sorted.

I can get sort, I can get stripe but buggered if I can find ready
made easy to apply sort and stripe. No urgency. I am quite happy
really to just continue having stripe and with a few tables,
forget the stripe and have sort. It is no big deal. Just see how
bored and magnanimous any of you feel for such an undoubtedly
trivial problem for js experts...

--
dorayme
From: Evertjan. on
dorayme wrote on 31 jan 2010 in comp.lang.javascript:

> In article <hk2fi1$mu4$1(a)news.eternal-september.org>,
> Gregor Kofler <usenet(a)gregorkofler.com> wrote:
>
>> ... So far the OP hasn't said
>> anything about the size of her (or his) table.
>
> I have a lot of them of different lengths, not more than one to a
> page, the biggest is not more than 200 rows.
>
> I am still looking for a simple sorterer for just towns column
> and striper combined. When I have more time I will work this one
> out I guess, but if anyone has one that does *just this job*
> really reliably, may I grab it please? I have posted a URL of the
> sort of table.
>
> http://dorayme.netweaver.com.au/tableSortCandidate.html
>
> Necessary to know in any example is how *not* to have columns
> sorted. The first col is towns (alphabetical), second is
> postcodes, the rest are not to be sorted.
>
> I can get sort, I can get stripe but buggered if I can find ready
> made easy to apply sort and stripe.

The striping was answered nicely by Gregor:

var classNames = ["row0", "row1"], r = yourTable.rows, i;
var l = r.length;
for(i = 0, i < l; i++) {
r[i].className = classNames[i % classNames.length];
};

In my example, restriping is not neccessary.

===============================

In my example

r.sort();

gives a topdown sort

===

the reversal is:

function sortReversed(a,b){return a>b;};

r.sort(sortReversed);

===

numerical sort:

function sortNumber(a,b){return a - b;};

r.sort(sortNumber);

===

numerical reversed sort I leave to youe imagination.




--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
From: Matt Kruse on
On Jan 30, 5:04 pm, "Evertjan." <exjxw.hannivo...(a)interxnl.net> wrote:
> Tables of "200 rows"?
> Those things should not be on a HTML page.

That's a very simplistic view of the web. Tables with thousands of
rows are not uncommon in some situations.

The table-sorting/striping problem is easier to solve, of course, if
you arbitrarily limit the scope so that inefficient solutions perform
just as well as more optimized solutions.

Matt Kruse
From: Evertjan. on
Matt Kruse wrote on 01 feb 2010 in comp.lang.javascript:

> On Jan 30, 5:04�pm, "Evertjan." <exjxw.hannivo...(a)interxnl.net> wrote:
>> Tables of "200 rows"?
>> Those things should not be on a HTML page.
>
> That's a very simplistic view of the web. Tables with thousands of
> rows are not uncommon in some situations.

Bad implementations are not uncommon on the web, Matt,
so commonness does not imply solution quality or logic.

> The table-sorting/striping problem is easier to solve, of course, if
> you arbitrarily limit the scope so that inefficient solutions perform
> just as well as more optimized solutions.

I do not agree.

Long tables are nonsensical for readable html.

There is no sense in clienside sorting of such long tables,
even if they are ment for copying and not reading.

They should be sorted serversifde, since the most obvious source of those
tables is a database anyway.

> that inefficient solutions perform
> just as well as more optimized solutions.

What can be inefficient or optimized about solutions
that "perform just as well"?

Short, easily readable and easily debuggable code
is the only efficiency gain to be won when the performance is just as well.

That gain is not a gain to the client user, only ease and beauty to the
programmer.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)