Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19817 > unrolled thread
| Started by | fulio pen <fuliopen@yahoo.com> |
|---|---|
| First post | 2013-05-18 17:40 -0700 |
| Last post | 2013-05-19 11:23 +0200 |
| Articles | 10 — 6 participants |
Back to article view | Back to comp.lang.javascript
Sorting fulio pen <fuliopen@yahoo.com> - 2013-05-18 17:40 -0700
Re: Sorting Andrew Poulos <ap_prog@hotmail.com> - 2013-05-19 12:06 +1000
Re: Sorting Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-18 19:10 -0700
Re: Sorting Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-19 02:15 +0000
Re: Sorting Stefan Weiss <krewecherl@gmail.com> - 2013-05-19 04:44 +0200
Re: Sorting fulio pen <fuliopen@yahoo.com> - 2013-05-19 15:43 -0700
Re: Sorting fulio pen <fuliopen@yahoo.com> - 2013-05-19 16:37 -0700
Re: Sorting Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-20 00:37 +0000
Re: Sorting fulio pen <fuliopen@yahoo.com> - 2013-05-20 07:13 -0700
Re: Sorting Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-19 11:23 +0200
| From | fulio pen <fuliopen@yahoo.com> |
|---|---|
| Date | 2013-05-18 17:40 -0700 |
| Subject | Sorting |
| Message-ID | <26eac9be-f8cb-4364-b925-51d2fee45d42@e14g2000yqp.googlegroups.com> |
Hello, Please open the following page. My intention is that when clicking the head of a column, sorting will happen. But nothing has happened so far. http://www.pinyinology.com/css/officials2b.html I wrote some js code, but it obviously didn't work. Please help modify the code. Thanks a lot. fulio pen
[toc] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2013-05-19 12:06 +1000 |
| Message-ID | <RrGdndpqevRTrgXMnZ2dnUVZ_sadnZ2d@westnet.com.au> |
| In reply to | #19817 |
On 19/05/2013 10:40 AM, fulio pen wrote: > Hello, > > Please open the following page. My intention is that when clicking > the head of a column, sorting will happen. But nothing has happened > so far. > > http://www.pinyinology.com/css/officials2b.html > > I wrote some js code, but it obviously didn't work. Please help > modify the code. Thanks a lot. IE9 reports Message: Syntax error Line: 73 Char: 1 Code: 0 URI: http://www.pinyinology.com/css/officials2b.html Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Scott Sauyet <scott.sauyet@gmail.com> |
|---|---|
| Date | 2013-05-18 19:10 -0700 |
| Message-ID | <956fa7b6-00d3-4ed3-a3c2-d6f84dc2906f@b2g2000yqe.googlegroups.com> |
| In reply to | #19817 |
fulio pen wrote:
> Please open the following page. My intention is that when clicking
> the head of a column, sorting will happen. But nothing has happened
> so far.
>
> http://www.pinyinology.com/css/officials2b.html
>
> I wrote some js code, but it obviously didn't work. Please help
> modify the code. Thanks a lot.
Sorry, that's not the way it generally works around here. Please do
some more work first.
Post a well-formatted, brief version of your code here. Explain what
you think should happen with it and why. Describe what actually
happened. Tell us what sorts of things you've tried in order to fix
it.
Please read both of the following documents:
<http://jibbering.com/faq/#posting>
<http://www.catb.org/esr/faqs/smart-questions.html>
-- Scott
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-19 02:15 +0000 |
| Message-ID | <kn9ckf$1h4$2@dont-email.me> |
| In reply to | #19817 |
On Sat, 18 May 2013 17:40:34 -0700, fulio pen wrote: > Please open the following page. My intention is that when clicking the > head of a column, sorting will happen. But nothing has happened so > far. Do you want something like this: http://www.sined.co.uk/tmp/pinyin.htm -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Date | 2013-05-19 04:44 +0200 |
| Message-ID | <kn9eb8$hgp$1@news.albasani.net> |
| In reply to | #19817 |
On 2013-05-19 02:40, fulio pen wrote:
> Please open the following page. My intention is that when clicking
> the head of a column, sorting will happen. But nothing has happened
> so far.
I'm not surprised. Clicking one of the links just loads the same page
with a new query string ("?sortByID", "?sortBydob", ...), that's all.
The table won't magically sort itself just because the URL is different.
> http://www.pinyinology.com/css/officials2b.html
>
> I wrote some js code, but it obviously didn't work. Please help
> modify the code. Thanks a lot.
I'm not sure where to start... there aren't any functions that could
modify the table or the source array, and the rest is full of errors.
First of all, you should eliminate the HTML errors.
http://validator.w3.org/ can help with that.
One very obvious problem is this:
<head>
...
<script>
<!--
...
</script>
</head>
<body>
...
<script>
...
-->
</script>
Look at where the comments start and end. This may have caused the
syntax error in IE that Andrew posted (can't test due to lack of IE).
Using HTML comments to hide JS code from old browsers hasn't been
necessary for eons; just remove them.
Next, you should let your script read the query string and react
appropriately (by sorting the array before you write() the table).
If you're more interested in the result than how to get there, you could
also use a library to handle the table sorting for you. Many libraries
have something like that built-in or available as a plugin.
For example: http://vxweb.net/sortable#example
- stefan
[toc] | [prev] | [next] | [standalone]
| From | fulio pen <fuliopen@yahoo.com> |
|---|---|
| Date | 2013-05-19 15:43 -0700 |
| Message-ID | <21b07e97-6430-4ebd-b62a-71602f404de0@d6g2000yqi.googlegroups.com> |
| In reply to | #19821 |
On May 18, 10:44 pm, Stefan Weiss <krewech...@gmail.com> wrote:
> On 2013-05-19 02:40, fulio pen wrote:
>
> > Please open the following page. My intention is that when clicking
> > the head of a column, sorting will happen. But nothing has happened
> > so far.
>
> I'm not surprised. Clicking one of the links just loads the same page
> with a new query string ("?sortByID", "?sortBydob", ...), that's all.
> The table won't magically sort itself just because the URL is different.
>
> >http://www.pinyinology.com/css/officials2b.html
>
> > I wrote some js code, but it obviously didn't work. Please help
> > modify the code. Thanks a lot.
>
> I'm not sure where to start... there aren't any functions that could
> modify the table or the source array, and the rest is full of errors.
>
> First of all, you should eliminate the HTML errors.http://validator.w3.org/can help with that.
>
> One very obvious problem is this:
>
> <head>
> ...
> <script>
> <!--
> ...
> </script>
> </head>
> <body>
> ...
> <script>
> ...
> -->
> </script>
>
> Look at where the comments start and end. This may have caused the
> syntax error in IE that Andrew posted (can't test due to lack of IE).
> Using HTML comments to hide JS code from old browsers hasn't been
> necessary for eons; just remove them.
>
> Next, you should let your script read the query string and react
> appropriately (by sorting the array before you write() the table).
>
> If you're more interested in the result than how to get there, you could
> also use a library to handle the table sorting for you. Many libraries
> have something like that built-in or available as a plugin.
> For example:http://vxweb.net/sortable#example
>
> - stefan
Thanks to all for your help. A while ago someone helped me with a
sorting in the following page:
http://www.pinyinology.com/sortable/shuihu/heavenly.html?sortByName
The code worked. This time I just wanted to following suit in another
sorting by myself:
http://www.pinyinology.com/css/officials2b.html
But the code didn't work. Thank you again.
fulio pen
[toc] | [prev] | [next] | [standalone]
| From | fulio pen <fuliopen@yahoo.com> |
|---|---|
| Date | 2013-05-19 16:37 -0700 |
| Message-ID | <659cc1b9-694e-404a-88ad-dd158682e87a@r3g2000yqe.googlegroups.com> |
| In reply to | #19821 |
On May 18, 10:44 pm, Stefan Weiss <krewech...@gmail.com> wrote:
> On 2013-05-19 02:40, fulio pen wrote:
>
> > Please open the following page. My intention is that when clicking
> > the head of a column, sorting will happen. But nothing has happened
> > so far.
>
> I'm not surprised. Clicking one of the links just loads the same page
> with a new query string ("?sortByID", "?sortBydob", ...), that's all.
> The table won't magically sort itself just because the URL is different.
>
> >http://www.pinyinology.com/css/officials2b.html
>
> > I wrote some js code, but it obviously didn't work. Please help
> > modify the code. Thanks a lot.
>
> I'm not sure where to start... there aren't any functions that could
> modify the table or the source array, and the rest is full of errors.
>
> First of all, you should eliminate the HTML errors.http://validator.w3.org/can help with that.
>
> One very obvious problem is this:
>
> <head>
> ...
> <script>
> <!--
> ...
> </script>
> </head>
> <body>
> ...
> <script>
> ...
> -->
> </script>
>
> Look at where the comments start and end. This may have caused the
> syntax error in IE that Andrew posted (can't test due to lack of IE).
> Using HTML comments to hide JS code from old browsers hasn't been
> necessary for eons; just remove them.
>
> Next, you should let your script read the query string and react
> appropriately (by sorting the array before you write() the table).
>
> If you're more interested in the result than how to get there, you could
> also use a library to handle the table sorting for you. Many libraries
> have something like that built-in or available as a plugin.
> For example:http://vxweb.net/sortable#example
>
> - stefan
Hi, Stefan,
With the html validator, I had one mistake, and understood that the
comment line <!-- had to be added, which I did. but the mistake
wouldn't be eliminated. If possible, please tell me what to do.
Following is the comments on that mistake.
Line 88, Column 31: Element script not allowed as child of element
tbody in this context. (Suppressing further errors from this subtree.)
<script type='text/javascript'>
Contexts in which element script may be used:
Where metadata content is expected.
Where phrasing content is expected.
Content model for element tbody:
Zero or more tr elements
Thanks for your help.
fulio pen
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-05-20 00:37 +0000 |
| Message-ID | <knbr87$hkc$1@dont-email.me> |
| In reply to | #19833 |
On Sun, 19 May 2013 16:37:42 -0700, fulio pen wrote: > Line 88, Column 31: Element script not allowed as child of element tbody > in this context. (Suppressing further errors from this subtree.) What it means is that you can't use <script></script> at that point in a table. However, you don't need to put script in that point in the table at all. If you want a script to run when the document body is loaded, it may be better to put it in the document head script section as a function, and then use the onload attribute of the body to call it. In addition, your calls to the javascript functions from links will not work that way. If you want to call a javascript function from a link, you need to specify the javascript protocol and the function, eg: <a href="javascript:function();" ....>link text</a> However, it is often just as easy to call Javascript functions using the onclick handler of a span or some other element. <span onclick="function();" ....>text</span> Finally, sorting the data will not change the table, you need to (re)populate the table with the sorted data afterwards. I've just edited my example, if you looked at it earlier you may want to look again - I realised I was doing extra work manipulating the table that wasn't needed. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | fulio pen <fuliopen@yahoo.com> |
|---|---|
| Date | 2013-05-20 07:13 -0700 |
| Message-ID | <ba73f595-9b84-44e5-8674-5f46ba3c051b@e14g2000yqp.googlegroups.com> |
| In reply to | #19834 |
On May 19, 8:37 pm, Denis McMahon <denismfmcma...@gmail.com> wrote: > On Sun, 19 May 2013 16:37:42 -0700, fulio pen wrote: > > Line 88, Column 31: Element script not allowed as child of element tbody > > in this context. (Suppressing further errors from this subtree.) > > What it means is that you can't use <script></script> at that point in a > table. > > However, you don't need to put script in that point in the table at all. > > If you want a script to run when the document body is loaded, it may be > better to put it in the document head script section as a function, and > then use the onload attribute of the body to call it. > > In addition, your calls to the javascript functions from links will not > work that way. If you want to call a javascript function from a link, you > need to specify the javascript protocol and the function, eg: > > <a href="javascript:function();" ....>link text</a> > > However, it is often just as easy to call Javascript functions using the > onclick handler of a span or some other element. > > <span onclick="function();" ....>text</span> > > Finally, sorting the data will not change the table, you need to > (re)populate the table with the sorted data afterwards. > > I've just edited my example, if you looked at it earlier you may want to > look again - I realised I was doing extra work manipulating the table > that wasn't needed. > > -- > Denis McMahon, denismfmcma...@gmail.com Dennis, Thanks a lot for your help. fulio pen
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-05-19 11:23 +0200 |
| Message-ID | <2042879.9D0TvSpaVU@PointedEars.de> |
| In reply to | #19817 |
fulio pen wrote: > Please open the following page. No. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web