Making WebFX sortable table to work in IE



I try to use sortable DHTML table from

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
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
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

<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">
<td style="display:none">id</td>
<td style="display:none">3</td>
<td style="display:none">2</td>


<script type="text/javascript">
var st1 = new SortableTable(document.getElementById("table-1"));


Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question