Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23370 > unrolled thread
| Started by | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| First post | 2014-03-03 16:57 -0700 |
| Last post | 2014-03-06 23:24 +0100 |
| Articles | 20 on this page of 51 — 11 participants |
Back to article view | Back to comp.lang.javascript
Reversing the rows of a table ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-03-03 16:57 -0700
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 01:15 +0100
Re: Reversing the rows of a table ?? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-03 16:19 -0800
Re: Reversing the rows of a table ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-03-03 17:31 -0700
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 01:36 +0100
Re: Reversing the rows of a table ?? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-03 18:51 -0800
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 08:57 +0100
Re: Reversing the rows of a table ?? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2014-03-04 09:13 +0100
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 09:49 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-04 12:16 +0100
Re: Reversing the rows of a table ?? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-04 06:37 -0800
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-04 15:56 +0100
Re: Reversing the rows of a table ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-03-04 09:10 -0700
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-04 17:56 +0100
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 21:47 +0100
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 22:38 +0100
Re: Reversing the rows of a table ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-03-04 15:46 -0700
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-05 00:18 +0100
Re: Reversing the rows of a table ?? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-04 16:17 -0800
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-05 09:06 +0100
Re: Reversing the rows of a table ?? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-05 17:49 +0100
Re: Reversing the rows of a table ?? Christian Winter <thepoet_nospam@arcor.de> - 2014-03-05 06:50 +0100
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-05 09:07 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-05 16:42 +0100
Re: Reversing the rows of a table ?? Christian Winter <thepoet_nospam@arcor.de> - 2014-03-06 07:28 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-06 10:58 +0100
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-06 11:11 +0100
Re: Reversing the rows of a table ?? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-06 10:35 -0300
Re: Reversing the rows of a table ?? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-04 11:06 -0800
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-04 20:22 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-04 20:55 +0100
Re: Reversing the rows of a table ?? ompalompasales2@gmail.com - 2014-03-04 12:59 -0800
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-05 23:05 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-05 23:42 +0100
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 14:57 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-06 22:37 +0100
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 23:04 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-06 23:20 +0100
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 23:31 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-07 00:30 +0100
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-07 18:10 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-07 22:49 +0100
Re: Reversing the rows of a table ?? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-06 19:21 -0300
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 23:41 +0100
Re: Reversing the rows of a table ?? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-06 22:45 -0300
Re: Reversing the rows of a table ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-05 23:47 +0100
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 14:57 +0100
Re: Reversing the rows of a table ?? Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-05 23:41 +0000
Re: Reversing the rows of a table ?? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-06 18:56 -0300
Re: Reversing the rows of a table ?? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-03-06 23:18 +0100
Re: Reversing the rows of a table ?? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-06 23:24 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2014-03-03 16:57 -0700 |
| Subject | Reversing the rows of a table ?? |
| Message-ID | <bnkj72FqrjaU1@mid.individual.net> |
Hi:
Enviro:
A small table (usually less than twenty rows and always has six
columns)
Question:
Is there a 'quickie' ES/JS way to reverse the rows of the table during
the onload process?
btw, this table is built at the server from a potentiually big database
and is always subject to change.
another btw, I *could* do this at the server, but it's a bit painful
...
Thanks,
--
Mel Smith
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 01:15 +0100 |
| Message-ID | <XnsA2E6CC301E3Feejj99@194.109.133.133> |
| In reply to | #23370 |
"Mel Smith" <med_cutout_syntel@aol.com> wrote on 04 mrt 2014 in comp.lang.javascript: > Enviro: > A small table (usually less than twenty rows and always has six > columns) > > Question: > > Is there a 'quickie' ES/JS way to reverse the rows of the table > during the onload process? Is onload a process? > btw, this table is built at the server from a potentiually big > database and is always subject to change. > > another btw, I *could* do this at the server, but it's a bit > painful Sorry it hurts, but you should do this serverside. That's where SQL "order by" potentiually is for. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-03-03 16:19 -0800 |
| Message-ID | <6ecd1d1a-8bd0-4c4f-8f38-c5d6ff8e012a@googlegroups.com> |
| In reply to | #23370 |
On Monday, March 3, 2014 5:57:21 PM UTC-6, Mel Smith wrote: > Is there a 'quickie' ES/JS way to reverse the rows of the table during > the onload process? You want to reverse the rows before you have all the rows?
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2014-03-03 17:31 -0700 |
| Message-ID | <bnkl7sFr7tdU1@mid.individual.net> |
| In reply to | #23374 |
Michael said:
>
> You want to reverse the rows before you have all the rows?
Hi Michael:
No, after the table is completely loaded, then I wish to hide the table,
reverse the rows, then show the table
To Evertjan:
I don't use SQL, I use the 'Comix' database system.
On my server, while building, re-building, deleting records (by
nullifying a key field) , adding records (by looking for nulled-out records
or appending blank records), I have a ' keyed' set of records that I read in
order of their position in the dbf file. I would 'rather' reverse these
records/rows at the client end, than try to capture them in reverse
order -- altho I could do it (but I don't want too :) )
Thanks !
-Mel
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 01:36 +0100 |
| Message-ID | <XnsA2E6105AB736Beejj99@194.109.133.133> |
| In reply to | #23376 |
"Mel Smith" <med_cutout_syntel@aol.com> wrote on 04 mrt 2014 in comp.lang.javascript: > Michael said: >> >> You want to reverse the rows before you have all the rows? > > Hi Michael: > > No, after the table is completely loaded, then I wish to hide the > table, reverse the rows, then show the table > > To Evertjan: > > I don't use SQL, I use the 'Comix' database system. > On my server, while building, re-building, deleting records (by > nullifying a key field) , adding records (by looking for nulled-out > records or appending blank records), I have a ' keyed' set of records > that I read in order of their position in the dbf file. I would > 'rather' reverse these records/rows at the client end, than try to > capture them in reverse order -- altho I could do it (but I don't want > too :) ) Wrong argumentation, methinks. If you must, fill a clientside array, manipulate the array clientside and build the table with dom-commands. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-03-03 18:51 -0800 |
| Message-ID | <e9d2a9ad-89b7-4ade-9404-85d724dfa252@googlegroups.com> |
| In reply to | #23376 |
On Monday, March 3, 2014 6:31:53 PM UTC-6, Mel Smith wrote: > Michael said: > > > > You want to reverse the rows before you have all the rows? [...] > No, after the table is completely loaded, then I wish to hide the table, > reverse the rows, then show the table One approach is to create a second tbody in the table and then copy/move the old rows from the bottom up into the new tbody and then remove the old tbody when complete. <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement> Evertjan is correct though that it would be wiser to populate a different data structure and then reverse it there before populating the table.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 08:57 +0100 |
| Message-ID | <XnsA2E65B193CE47eejj99@194.109.133.133> |
| In reply to | #23378 |
"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 04 mrt 2014 in
comp.lang.javascript:
> On Monday, March 3, 2014 6:31:53 PM UTC-6, Mel Smith wrote:
>> Michael said:
>> >
>> > You want to reverse the rows before you have all the rows?
> [...]
>> No, after the table is completely loaded, then I wish to hide the
>> table,
>> reverse the rows, then show the table
>
> One approach is to create a second tbody in the table and then copy/move
> the old rows from the bottom up into the new tbody and then remove the
> old tbody when complete.
>
> <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement>
>
> Evertjan is correct though that it would be wiser to populate a
> different data structure and then reverse it there before populating the
> table.
.. and such reversal could far more reliably be done in serverside code,
even if the database engine is so inferior to present standards that it
cannot do it itself.
[serverside javascript]
var rows = [];
rows[0] = [7,'bye']; // filled by defunct database
rows[1] = [17,'gone']; // filled by defunct database
// =======================
var i = rows.length-1;
response.write('<table class="thisOne">');
while (i>=0)
response.write('\n<tr><td>'+rows[i][0]+'<td>'+rows[i--][1]);
response.write('\n</table>');
[/serverside javascript]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> |
|---|---|
| Date | 2014-03-04 09:13 +0100 |
| Message-ID | <se2bh9d8f360mpnlkqlukc1cpgeqoks1pu@4ax.com> |
| In reply to | #23378 |
On Mon, 3 Mar 2014 18:51:11 -0800 (PST), Michael Haufe (TNO) wrote: >On Monday, March 3, 2014 6:31:53 PM UTC-6, Mel Smith wrote: >> Michael said: >> > You want to reverse the rows before you have all the rows? >[...] >> No, after the table is completely loaded, then I wish to hide the table, >> reverse the rows, then show the table >One approach is to create a second tbody in the table and then copy/move the old rows from the bottom up into the new tbody and then remove the old tbody when complete. > ><https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement> > >Evertjan is correct though that it would be wiser to populate a different data structure and then reverse it there before populating the table. I do not quite see why it would be wiser or even better. For any but a very big table it does not matter how you do it. Stuffing the rows into a second tbody is one nice way to do it, but it is not much more difficult to swap them around in the same tbody. I sometimes do this to allow the user to sort the table in different ways by clicking on the header of the sort column. Because you have plenty of processor power on a typical computer, you can use a very simple algorithm like bubble sort, and it is still instantaneous even for moderately large tables. This is, of course, much better than doing it server-side, because it reduces server load, data transfer load, and user time without having any disadvantage. Hans-Georg
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 09:49 +0100 |
| Message-ID | <XnsA2E663ECEBE3Feejj99@194.109.133.133> |
| In reply to | #23380 |
Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> wrote on 04 mrt 2014 in comp.lang.javascript: > On Mon, 3 Mar 2014 18:51:11 -0800 (PST), Michael Haufe (TNO) > wrote: > >>On Monday, March 3, 2014 6:31:53 PM UTC-6, Mel Smith wrote: > >>> Michael said: > >>> > You want to reverse the rows before you have all the rows? >>[...] >>> No, after the table is completely loaded, then I wish to hide the >>> table, >>> reverse the rows, then show the table > >>One approach is to create a second tbody in the table and then copy/move >>the old rows from the bottom up into the new tbody and then remove the >>old tbody when complete. >> >><https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement> >> >>Evertjan is correct though that it would be wiser to populate a >>different data structure and then reverse it there before populating the >>table. > > I do not quite see why it would be wiser or even better. For any > but a very big table it does not matter how you do it. > > Stuffing the rows into a second tbody is one nice way to do it, > but it is not much more difficult to swap them around in the > same tbody. > > I sometimes do this to allow the user to sort the table in > different ways by clicking on the header of the sort column. That was not in the OQ specs. That was a clientside row inversion at onload time, where the table was held or made invisible till reversed. > Because you have plenty of processor power on a typical > computer, you can use a very simple algorithm like bubble sort, > and it is still instantaneous even for moderately large tables. A bubble sort does not inverse, it is like an bubble-bath where you just want a glass of cold water. Not my definition of 'instantaneous'. > This is, of course, much better than doing it server-side, My old math-teacher warned me for any 'of course' in a reasoning argument, such being suggestive of the possibility that the speaker did not ... [suppressed]. > because it reduces server load, data transfer load, and user > time without having any disadvantage. No it does not, because: 1 the server load remains the same if properly 'order by'-ed. The OP implied that the database action was lengthy anyway, methinks. 2 user time is better when the html is seen as is, and the teble is not made invisible till the reveral is finished. 3 data transfer is marginally smaller as the script lines are not transfered. 4 What about "javascript switched off" disadvantage, serverside javascript cannot be switched of by the user. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-03-04 12:16 +0100 |
| Message-ID | <2779103.sO63zRiCyQ@PointedEars.de> |
| In reply to | #23378 |
Michael Haufe (TNO) wrote:
> On Monday, March 3, 2014 6:31:53 PM UTC-6, Mel Smith wrote:
>> Michael said:
>> >
>> > You want to reverse the rows before you have all the rows?
> [...]
>> No, after the table is completely loaded, then I wish to hide the
>> table,
>> reverse the rows, then show the table
>
> One approach is to create a second tbody in the table and then copy/move
> the old rows from the bottom up into the new tbody and then remove the old
> tbody when complete.
>
> <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement>
>
> Evertjan is correct though that it would be wiser to populate a different
> data structure and then reverse it there before populating the table.
That would require
1a. Creating a native object.
2a. Copying the table (body) data to that object.
3a. Reversing the order of the data in the object.
3b. nothing
4a. Copying the data from the object to the DOM object.
4b. Copying the data from the object to the DOM object
in reverse order.
By contrast, you could just
1c. Reverse the order of the nodes in the document tree in place.
Why is the former wiser?
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-03-04 06:37 -0800 |
| Message-ID | <f01b8aa7-955d-4b55-b6f7-5795dd7b8d95@googlegroups.com> |
| In reply to | #23382 |
On Tuesday, March 4, 2014 5:16:09 AM UTC-6, Thomas 'PointedEars' Lahn wrote: > Michael Haufe (TNO) wrote: > > > One approach is to create a second tbody in the table and then copy/move > > the old rows from the bottom up into the new tbody and then remove the old > > tbody when complete. > > > > <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement> > > > > Evertjan is correct though that it would be wiser to populate a different > > data structure and then reverse it there before populating the table. > > That would require > > 1a. Creating a native object. > 2a. Copying the table (body) data to that object. > 3a. Reversing the order of the data in the object. > 3b. nothing > 4a. Copying the data from the object to the DOM object. > 4b. Copying the data from the object to the DOM object > in reverse order. > > By contrast, you could just > > 1c. Reverse the order of the nodes in the document tree in place. > > Why is the former wiser? It isn't, nor did I suggest it. I think you've misinterpreted what was written.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-03-04 15:56 +0100 |
| Message-ID | <1437763.yZijEUq800@PointedEars.de> |
| In reply to | #23383 |
Michael Haufe (TNO) wrote: > Thomas 'PointedEars' Lahn wrote: >> Michael Haufe (TNO) wrote: >> > One approach is to create a second tbody in the table and then >> > copy/move the old rows from the bottom up into the new tbody and then >> > remove the old tbody when complete. >> > >> > <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement> >> > >> > Evertjan is correct though that it would be wiser to populate a >> > different data structure and then reverse it there before populating >> > the table. >> >> That would require >> >> 1a. Creating a native object. >> 2a. Copying the table (body) data to that object. >> 3a. Reversing the order of the data in the object. >> 3b. nothing >> 4a. Copying the data from the object to the DOM object. >> 4b. Copying the data from the object to the DOM object >> in reverse order. >> >> By contrast, you could just >> >> 1c. Reverse the order of the nodes in the document tree in place. >> >> Why is the former wiser? > > It isn't, nor did I suggest it. You agreed with that assessment. > I think you've misinterpreted what was written. If not the former four steps, what, then, do you understand to mean “populate a different data structure and reverse it there before populating the table”? -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2014-03-04 09:10 -0700 |
| Message-ID | <bnmc6tF7msaU1@mid.individual.net> |
| In reply to | #23384 |
Hi All:
I've read the comments / suggestions made by all oy you and appreciate
them.
After sleeping on this problem last nite, I've decided to do *both*
methods:
Server:
I will add a datetime field to my current database, then Seek Last
on the database for the set of records belonging to my client, then skip
backwards thru the dbf and then populate the table and send the page.
Client:
I will add a button to the page to allow the clent to reverse the
rows of the table as he wishes (i.e., 'flick' them back and forth as much as
he wants).
To Thomas: I'm interested in knowing about 'reversing the nodes' in
your earlier post. Can you amplify please ?
btw, I only have room to show about 5 rows of the table (in lower
right-hand corner of the page) without scrolling, and the user will be
taking other button actions elsewhere to cause the addition / deletion of
rows from this table. Each time he does so (with a .submit() ), I rebuild
the page (and the three *other* tables on this page) and send back the
modifications to this table.
Thanks to all !
-Mel Smith
(another btw, my database system *does have* a datetime field type (Type
'T') which I'll use to serialize the set of records while building table
rows at server. But my user may well wish to reverse them again at the
client end.)
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-03-04 17:56 +0100 |
| Message-ID | <5986796.BADGFOqJNZ@PointedEars.de> |
| In reply to | #23386 |
Mel Smith wrote: > To Thomas: I'm interested in knowing about 'reversing the nodes' > in > your earlier post. Can you amplify please ? Certainly. Can you adhere to Netiquette, RFC 5536 §3.1.2, and the AOL TOS? <http://tools.ietf.org/html/rfc5536#section-3.1.2> <http://legal.aol.com/terms-of-service/full-terms/> <http://www.interhack.net/pubs/munging-harmful/> -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 21:47 +0100 |
| Message-ID | <XnsA2E6DDBFF55CFeejj99@194.109.133.133> |
| In reply to | #23386 |
"Mel Smith" <med_cutout_syntel@aol.com> wrote on 04 mrt 2014 in
comp.lang.javascript:
> Client:
> I will add a button to the page to allow the clent to reverse
> the
> rows of the table as he wishes (i.e., 'flick' them back and forth as
> much as he wants).
I would try to guess, or better measure, how many of my users make use of
this 'flicking'. If it was less than say 3%, I would reload the page and do
this serverside.
> To Thomas: I'm interested in knowing about 'reversing the nodes' in
> your earlier post. Can you amplify please ?
Try this, no doubt there are more direct/elegant ways [PE?].
Click each individual table to swap.
=============================================
<table border=1 onclick='swapTable(this)'>
<tr><td>1
<tr><td>2
<tr><td>3
<tr><td>4
<tr><td style='background-color:red;'>5
</table>
<br>
<table border=1 onclick='swapTable(this)'>
<tr><td>aaaaaaaaaaaaa<td>2nd
<tr><td>x<td>
<tr><td style='background-color:red;'>mmm<td>
</table>
<script type='text/javascript'>
function swapTable(t) {
var children = t.getElementsByTagName('tr');
var tbody = children[0].parentNode;
var temp = [];
for (var i=children.length;i>0;i--)
temp.push(tbody.removeChild(children[i-1]));
for (var i=0;i<temp.length;i++)
tbody.insertBefore(temp[i],null);
};
</script>
=============================================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-04 22:38 +0100 |
| Message-ID | <XnsA2E6E664BA33Feejj99@194.109.133.133> |
| In reply to | #23398 |
"Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote on 04 mrt 2014 in
comp.lang.javascript:
> Try this, no doubt there are more direct/elegant ways [PE?].
> Click each individual table to swap.
>
> =============================================
> <table border=1 onclick='swapTable(this)'>
> <tr><td>1
> <tr><td>2
> <tr><td>3
> <tr><td>4
> <tr><td style='background-color:red;'>5
> </table>
> <br>
> <table border=1 onclick='swapTable(this)'>
> <tr><td>aaaaaaaaaaaaa<td>2nd
> <tr><td>x<td>
> <tr><td style='background-color:red;'>mmm<td>
> </table>
>
>
> <script type='text/javascript'>
>
> function swapTable(t) {
> var children = t.getElementsByTagName('tr');
> var tbody = children[0].parentNode;
> var temp = [];
>
> for (var i=children.length;i>0;i--)
> temp.push(tbody.removeChild(children[i-1]));
> for (var i=0;i<temp.length;i++)
> tbody.insertBefore(temp[i],null);
>};
>
> </script>
> =============================================
>
Optimizing:
<script type='text/javascript'>
function swapTable(t) {
var tr = t.getElementsByTagName('tr');
var tbody = tr[0].parentNode;
var i = tr.length - 1;
while (i)
tbody.insertBefore(tbody.removeChild(tr[--i]),null);
};
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2014-03-04 15:46 -0700 |
| Message-ID | <bnn3e0FcqudU1@mid.individual.net> |
| In reply to | #23409 |
Evertjan said:
>
> Optimizing:
>
> <script type='text/javascript'>
>
> function swapTable(t) {
> var tr = t.getElementsByTagName('tr');
> var tbody = tr[0].parentNode;
> var i = tr.length - 1;
> while (i)
> tbody.insertBefore(tbody.removeChild(tr[--i]),null);
> };
>
> </script>
Hi Evertjan:
Thank you for the swapping code above !
-Mel Smith
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-05 00:18 +0100 |
| Message-ID | <XnsA2E732525251eejj99@194.109.133.133> |
| In reply to | #23410 |
"Mel Smith" <med_cutout_syntel@aol.com> wrote on 04 mrt 2014 in
comp.lang.javascript:
> Evertjan said:
>>
>> Optimizing:
>>
>> <script type='text/javascript'>
>>
>> function swapTable(t) {
>> var tr = t.getElementsByTagName('tr');
>> var tbody = tr[0].parentNode;
>> var i = tr.length - 1;
>> while (i)
>> tbody.insertBefore(tbody.removeChild(tr[--i]),null);
>> };
>>
>> </script>
>
> Thank you for the swapping code above !
Ok, but do you understand the how of the code?
If you do
var i = tr.length;
in stead of
var i = tr.length - 1;
it seems to do the exactly same.
Why is that less efficient?
Anyone?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2014-03-04 16:17 -0800 |
| Message-ID | <5f4da34a-e2a6-4ec4-a05f-fb79ffa27265@googlegroups.com> |
| In reply to | #23409 |
On Tuesday, March 4, 2014 3:38:54 PM UTC-6, Evertjan. wrote: [...] > while (i) > tbody.insertBefore(tbody.removeChild(tr[--i]),null); [...] tbody.insertBefore(tr[--i],null);
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-03-05 09:06 +0100 |
| Message-ID | <XnsA2E75C9A395E0eejj99@194.109.133.133> |
| In reply to | #23412 |
"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 05 mrt 2014 in comp.lang.javascript: > On Tuesday, March 4, 2014 3:38:54 PM UTC-6, Evertjan. wrote: > > [...] >> while (i) >> tbody.insertBefore(tbody.removeChild(tr[--i]),null); > [...] > > tbody.insertBefore(tr[--i],null); So the insert is a move? [the before with a null being realy an after] -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web