Making WebFX sortable table to work in IE

Discussion in 'Javascript' started by Andrus, Jul 2, 2003.

  1. Andrus

    Andrus Guest

    I try to use sortable DHTML table from
    http://www.webfx.eae.net/dhtml/sortabletable/sortabletable.html

    Unfortunately, it does not work correctly in IE due to IE bug.

    To reproduce:

    1. Run the code from the end of this message in IE.
    2. Click in the Price column

    Observed result:

    Sort icon appears in Item column

    Expected result:

    Sort icon must appear in Price column

    Script autor wrote:

    It is a bug in IE. The script works fine in all browsers except IE. The bug
    in
    IE is that cellIndex returns incorrect values when you hide cells.

    From W3C:

    cellIndex of type long, readonly
    The index of this cell in the row, starting from 0. This index
    is in document tree order and not display order.

    From MSDN:

    Collection indexes are in the source order of the HTML document.
    IE does not even follow the MSDN documentation.


    Script author refuses to fix it.
    He recommands the following fix:

    Create a function that looks something like this (too slow to be used in the
    regular case)

    function getCellIndex(c) {
    if (ie)
    LOOP and check display
    else
    return c.cellIndex
    }

    Unfortunately, I'm new to javascript to implement this.
    Can anybody fix this bug and create a modified sortabletable.css file ?

    Code to reproduce the problem.
    you should also load sortabletable.js and sortabletable.css files from
    http://www.webfx.eae.net/dhtml/sortabletable/sortabletable.html

    <script type="text/javascript" src="sortabletable.js"></script>
    <link type="text/css" rel="StyleSheet" href="sortabletable.css" />
    <table class="sort-table" id="table-1" cellspacing="0">
    <thead>
    <tr>
    <td style="display:none">id</td>
    <td>Item</td>
    <td>Price</td>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td style="display:none">3</td>
    <td>apple</td>
    <td>5</td>
    </tr>
    <tr>
    <td style="display:none">2</td>
    <td>orange</td>
    <td>15</td>
    </tr>

    </tbody>
    </table>

    <script type="text/javascript">
    var st1 = new SortableTable(document.getElementById("table-1"));
    </script></body></html>
     
    Andrus, Jul 2, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henri =?ISO-8859-15?Q?Schom=E4cker?=
    Replies:
    1
    Views:
    301
    Henri =?ISO-8859-15?Q?Schom=E4cker?=
    Dec 17, 2005
  2. yccheok

    Sortable Java Tree Table

    yccheok, Dec 26, 2007, in forum: Java
    Replies:
    1
    Views:
    1,100
    Roedy Green
    Dec 27, 2007
  3. Peter Pei

    sortable table in python 3.0

    Peter Pei, Feb 8, 2009, in forum: Python
    Replies:
    1
    Views:
    424
    Martin v. Löwis
    Feb 8, 2009
  4. dmsc17454_2

    Sortable Table

    dmsc17454_2, Jul 16, 2004, in forum: Javascript
    Replies:
    3
    Views:
    137
    Joakim Braun
    Jul 16, 2004
  5. Replies:
    6
    Views:
    549
Loading...

Share This Page