Script to sort tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?windows-1252?Q?=22=C1lvaro_G=2E_Vicario=22?=

    Script to sort tables

    I maintain a site that basically consists of a few hundred HTML tables
    with sales data. I need to add custom sorting to such tables: clicking
    on a table header should sort the table by that column.

    I think client-side JavaScript is the most feasible solution. Can you
    recommend me a pre-written script for this task? Requirements are:

    * I don’t expect it to work in tables with groups (which involve title
    rows, rowspans and subtotals) but it should at least consider a basic
    layout: header, data and footer

    * Data is formatted in Spanish and often has extra chars at the end
    (e.g. "1.000,25 EUR") so I guess the script should allow custom compare
    functions

    * Performance must be acceptable in "large" tables (let's say, a dozen
    columns along 500 rows)

    Thank you in advance for any suggestion,


    P.S. Yep, I'm already googling ;-)


    --
    -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    -- Mi sitio sobre programación web: http://bits.demogracia.com
    -- Mi web de humor al baño María: http://www.demogracia.com
    --
  • =?windows-1252?Q?=22=C1lvaro_G=2E_Vicario=22?=

    #2
    Re: Script to sort tables

    Álvaro G. Vicario escribió:
    I maintain a site that basically consists of a few hundred HTML tables
    with sales data. I need to add custom sorting to such tables: clicking
    on a table header should sort the table by that column.
    [...]
    P.S. Yep, I'm already googling ;-)
    Sorry, I hit "Send" by mistake; I was saying that I'm already googling
    but I've found so many scripts that I'm kinda lost.



    --
    -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    -- Mi sitio sobre programación web: http://bits.demogracia.com
    -- Mi web de humor al baño María: http://www.demogracia.com
    --

    Comment

    • Jorge

      #3
      Re: Script to sort tables

      On Jul 21, 1:57 pm, "Álvaro G. Vicario"
      <alvaroNOSPAMTH A...@demogracia .comwrote:
      I maintain a site that basically consists of a few hundred HTML tables
      with sales data. I need to add custom sorting to such tables: clicking
      on a table header should sort the table by that column.
      >
      I think client-side JavaScript is the most feasible solution. Can you
      recommend me a pre-written script for this task? Requirements are:
      >
      * I don’t expect it to work in tables with groups (which involve title
      rows, rowspans and subtotals) but it should at least consider a basic
      layout: header, data and footer
      >
      * Data is formatted in Spanish and often has extra chars at the end
      (e.g. "1.000,25 EUR") so I guess the script should allow custom compare
      functions
      >
      * Performance must be acceptable in "large" tables (let's say, a dozen
      columns along 500 rows)
      >
      Thank you in advance for any suggestion,
      Alvaro,

      Primer intento : http://tinyurl.com/55rtpf

      Va bien en Safari, Opera, IE, pero hace algo raro con la tabla en
      FireFox.

      Basta con hacer click en una columna para ordenar por esa columna.
      Otro click invierte el orden.
      Hay que revisar algunas cosas, pero es un principio.

      --Jorge.

      Comment

      • sheldonlg

        #4
        Re: Script to sort tables

        Jorge wrote:
        On Jul 21, 1:57 pm, "Álvaro G. Vicario"
        <alvaroNOSPAMTH A...@demogracia .comwrote:
        >I maintain a site that basically consists of a few hundred HTML tables
        >with sales data. I need to add custom sorting to such tables: clicking
        >on a table header should sort the table by that column.
        >>
        >I think client-side JavaScript is the most feasible solution. Can you
        >recommend me a pre-written script for this task? Requirements are:
        >>
        >* I don’t expect it to work in tables with groups (which involve title
        >rows, rowspans and subtotals) but it should at least consider a basic
        >layout: header, data and footer
        >>
        >* Data is formatted in Spanish and often has extra chars at the end
        >(e.g. "1.000,25 EUR") so I guess the script should allow custom compare
        >functions
        >>
        >* Performance must be acceptable in "large" tables (let's say, a dozen
        >columns along 500 rows)
        >>
        >Thank you in advance for any suggestion,
        >
        Alvaro,
        >
        Primer intento : http://tinyurl.com/55rtpf
        >
        Va bien en Safari, Opera, IE, pero hace algo raro con la tabla en
        FireFox.
        >
        Basta con hacer click en una columna para ordenar por esa columna.
        Otro click invierte el orden.
        Hay que revisar algunas cosas, pero es un principio.
        >
        --Jorge.

        Comment

        • Dr J R Stockton

          #5
          Re: Script to sort tables

          In comp.lang.javas cript message <3b6f8f4a-4071-4b63-a596-8181096c6f91@y3
          8g2000hsy.googl egroups.com>, Mon, 21 Jul 2008 12:24:41, Jorge
          <jorge@jorgecha morro.composted :
          >
          >Primer intento : http://tinyurl.com/55rtpf
          >
          IE7 - Error: 'parentNode' is null or not an object

          --
          (c) John Stockton, nr London, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
          Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
          Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
          Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)

          Comment

          Working...