WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => jQuery => Topic started by: Sander on August 06, 2010, 10:31:36 AM

Title: [solved] Tablesorter plugin
Post by: Sander on August 06, 2010, 10:31:36 AM
Hi all,

Are there any known problems using the jQueryAdmin tool and the tablesorter plugin in combination with IE8?

In all other browsers the plugin works fine (Firefox, Opera, Chrome, IE6 and IE7) but in IE8 I get a Javascript error:

Error: 'type' is empty or not an object
This is an error in the jquery.tablesorter. min.js file and it is in the line:

function getCachedSortType(parsers,i){return parsers.type;};

When I run IE8 in the compatibility modus there's no problem.

Does anybody have any idea what there can be wrong?
Title: Re: Tablesorter plugin
Post by: BlackBird on August 06, 2010, 11:10:20 AM
Try to use the plugin without jQueryAdmin to see if it is caused by the plugin itself. If it is, try to get support from the Tablesorter Homepage. http://tablesorter.com/
Title: Re: Tablesorter plugin
Post by: Sander on August 06, 2010, 11:35:04 AM
Already did that. There's still the same problem. I've searched the internet, the Tablesorter Homepage, the jQuery forum but nothing helps for now. There must be someone with the same problem I hope...
Title: Re: Tablesorter plugin
Post by: BlackBird on August 06, 2010, 01:43:16 PM
Hm. As the last version is of March 2008 (see http://tablesorter.com/changelog), while IE8 was released some time in 2009, this may causes the problem. Unfortunately, I am no JavaScript programmer, so I'm afraid I'm not able to help.

Edit: The demo page (http://tablesorter.com/docs/index.html) works with IE8. Dunno what's the problem. I did not pack this plugin for JQA. Maybe you should check the settings made in the default.preset file.
Title: Re: Tablesorter plugin
Post by: Sander on August 12, 2010, 09:40:38 AM
I will, but I can't find the problem yet.

Also saw the demo working on IE8.. Just have to search further..

Thanks for your answers!
Title: Re: Tablesorter plugin
Post by: pcwacht on August 12, 2010, 11:45:23 AM
Maybe this page helps : http://www.scholenmarktamersfoort.nl/nieuw/pages/alle-scholen-op-een-rij.php (Dutch sorry)
There I use a jquery tablesorter, not plugged in through jquery admin though!
Used jquery files: jquery-1.2.6.min.js, jquery.tablesorter-2.0.3.js, jquery.tablesorter. filer.js, jquery.tablesorter. pager2.js

It works like a charm in every tested browser.

Can give yout he files if needed.

John
Title: Re: Tablesorter plugin
Post by: Sander on August 12, 2010, 12:45:32 PM
Nederlands snap ik ook wel ;-)

Het zit zoals ik het nu kan beoordelen in de soort data (platte tekst, html, formulier) die in de verschillende cellen wordt geplaatst.

In English:
I think the problem occurs because of the data type in the table cells.I have to set the textExtraction to 'complex'. Maybe that helps.. Doesn't solve the problem.
Title: Re: Tablesorter plugin
Post by: Sander on August 12, 2010, 04:31:18 PM
[UPDATE]

It seems like tablesorter don't recognize all columns (only the first two) of the table. So the columns which can be sorted are not recognized as built-in sorters, so that where the JS error comes from, I think.
Title: Re: Tablesorter plugin
Post by: BlackBird on August 12, 2010, 04:36:16 PM
I think it works with the headers.

"tablesorter works on standard HTML tables. You must include THEAD and TBODY tags" (http://tablesorter.com/docs/index.html#Getting-Started)

Maybe you should take a deeper look at the Examples page to see what's "wrong" with your table.

It's a bit like "fishing in muddy waters" without having insight into the table page. :roll:
Title: Re: Tablesorter plugin
Post by: BlackBird on August 12, 2010, 05:33:36 PM
I've upgraded the plugin for JQA 2.x to be configurable in the backend. Won't fix the problem I'm afraid, but maybe helps playing around with the settings.

[gelöscht durch Administrator]
Title: Re: Tablesorter plugin
Post by: Sander on August 13, 2010, 02:08:18 PM
No it won't fix the problem.

It has to do with the data-type in the cells I think. Below the page where the table doesn't sort in IE8.
FF, Opera, Chrome all don't have problems with the sorting...

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
<script src="../modules/jqueryadmin/jquery-core/jquery-core.min.js" type="text/javascript"></script>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       <meta name="Keywords" content=""/>
<meta name="Description" content=""/>
        <script type="text/javascript" src="../modules/jqueryadmin/plugins/tablesorter/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="../modules/jqueryadmin/plugins/tablesorter/jquery.tablesorter.pager.js"></script>
<script type="text/javascript">
$(document).ready(function()
    {
         $("#resultaat").tablesorter({widgets: ['zebra'],
        // pass the headers argument and assign a object
        headers: {
            // assign the first column (we start counting zero)
            0: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the second column (we start counting zero)
            1: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the third column (we start counting zero)
            2: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the sixth column (we start counting zero)
            5: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the seventh column (we start counting zero)
            6: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the eighth column (we start counting zero)
            7: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the ninth column (we start counting zero)
            8: {
                // disable it by setting the property sorter to false
                sorter: false
            },
            // assign the tenth column (we start counting zero)
            9: {
                // disable it by setting the property sorter to false
                sorter: false
            }
        },
        debug: true
        });
    }
);
</script>
<link rel="stylesheet" href="../modules/jqueryadmin/plugins/tablesorter/blue/style.css" type="text/css" />
</head>
<body>
<table class="tablesorter" id="resultaat" width="98%">
  <thead>
<tr>
<th><b>Afb.</b></th>
  <th><b>Artikelnummer</b></th>
  <th><b>Omschrijving</b></th>
  <th><b>Bruto</b></th>
  <th><b>Netto</b></th>
  <th><b>Staffel</b></th>
  <th><b>Vrd</b></th>
  <th><b>Levertijd</b></th>
  <th><b>Aantal</b></th>
  <th></th>
  </tr>
  </thead>
  <tbody>
  <tr>
<td><form action="" method="post">
   <a href="#"><img src="29500030.jpg" width="30px"></a>
</td>
<td>artikelnummer1</td>
<td><div>artikelomschrijving1</div></td>
<td>&euro; 18,00</td>
<td>&euro; 9,00</td>
<td></td>
<td>14</td>
<td align="right">Aantallen en levertijd1</td>
<td><input type="text" name="aantal" value="1" size="2" onfocus="this.select();" /></td>
<td><input type="submit" name="cart" title="Toevoegen" value="" /></form></td>
</tr>
<tr>
<td><form action="" method="post">
   <a href="#><img src="29500505.jpg" width="30px"></a>
</td>
<td>Artikelnummer2</td>
<td><div>artikelomschrijving2</div></td>
<td>&euro; 33,00</td>
<td>&euro; 16,50</td>
<td></td>
<td>2<br>17</td>
<td align="right">Aantallen en levertijd2</td>
<td><input type="text" name="aantal" value="1" size="2" onfocus="this.select();" /></td>
<td><input type="submit" name="cart" title="Toevoegen" value="" /></form></td>
</tr>
  </tbody>
  </table>
</body>
</html>
Title: Re: Tablesorter plugin
Post by: pcwacht on August 13, 2010, 03:11:01 PM
Set the form tags outside the tabel!

This might do the trick
Allso you can test woithout the form tags first to see if it'll work.

Good luck hunting!
John
Title: Re: Tablesorter plugin
Post by: Sander on August 13, 2010, 03:34:51 PM
That does the trick!!!

Thanks a lot!!

I inserted the <form> tag in the last cell and then there's no problem. All sorter types are recognized and the table is sortable.

Thanks a lot again!
Title: Re: Tablesorter plugin
Post by: BlackBird on August 13, 2010, 03:41:38 PM
Best way is to put the opening <form> before the opening <table> and close the form after </table>, if the form includes the whole table. (Did not analyze if it does in this case.)

Also, make sure to nest the HTML tags right. It's not valid to open the form in one TD and close it in another one.

INVALID
<tr><td><form..>...</td><td>...</td><td></form></td></tr>

VALID
<tr><td></td><td>...</td><td><form..>...</form></td></tr>

I'm happy you solved your problem. :-D
Title: Re: Tablesorter plugin
Post by: pcwacht on August 13, 2010, 04:03:46 PM
See how posting code helps us helping!!

Have fun,
John
Title: Re: Tablesorter plugin
Post by: Sander on August 13, 2010, 04:48:20 PM
Indeed.

Each row is a form, so the form tags can't be outside the table. Now I have a valid form nested in one <td>

I'm happy also  8-)
Title: Re: Tablesorter plugin
Post by: BlackBird on August 14, 2010, 10:38:25 AM
I'm happy to hear that. Maybe you'd like to add [solved] to the subject line of the first posting. :wink: