Closed gianluis closed 10 years ago
Hi @gianluis!
If you look on the Home wiki page under "Widgets > Other", you'll see three demos labeled "Automatic Row numbering". Choose the one that fits your need.
The checkbox code was written to be use along with the "stickyHeaders" widget, but since you're not using it, you can remove part of the code that is causing an error. Also, tablesorter is initialized four times in the code, and the checkbox parser was not set to the correct column. Here is the corrected code (replace ALL of the code on the page with the following; demo):
<script>
// checkbox parser
$.tablesorter.addParser({
id: 'checkbox',
is: function (s) {
return false;
},
format: function (s, table, cell) {
var $c = $(cell).find('input');
console.log($c.is(':checked'));
return $c.length ? $c.is(':checked') ? 1 : 2 : s;
},
type: 'numeric'
});
// add custom numbering widget
$.tablesorter.addWidget({
id: "numbering",
format: function(table) {
var c = table.config;
$("tr:visible", table.tBodies[0]).each(function(i) {
$(this).find('td').eq(0).text(i + 1);
});
}
});
$(window).load(function () {
var $table = $('.tablesorter'),
c = $table[0].config,
wo = c.widgetOptions,
doChecky = function (c, col) {
$table.children('tbody')
.find('tr td:nth-child(' + (parseInt(col, 10) + 1) + ') input')
.each(function () {
this.checked = c;
$(this).trigger('change');
});
};
// using .on() which requires jQuery 1.7+
$table.children('tbody')
.on('change', 'input', function () {
$(this).closest('tr').toggleClass('checked', this.checked);
$(this).trigger('updateCell', [$(this).closest('td'), true]); // true = resort
// if a server side database needs to be updated, do it here
})
.end()
.find('thead input')
// Click on checkbox in table header to toggle all inputs
.on('change', function () {
var c = this.checked,
col = $(this).closest('th').attr('data-column');
doChecky(c, col);
})
.on('mouseup', function () {
return false;
});
});
$(function () {
var $table = $('.tablesorter').tablesorter({ debug: true,
theme: 'blue',
widgets: ["zebra", "filter", "numbering"],
widgetOptions: {
// filter_anyMatch replaced! Instead use the filter_external option
// Set to use a jQuery selector (or jQuery object) pointing to the
// external filter (column specific or any match)
filter_external: '.search',
// include column filters
filter_columnFilters: true,
filter_placeholder: {
search: 'Cerca...'
},
filter_saveFilters: true,
filter_reset: '.reset'
}
});
});
</script>
and include this css:
.tablesorter-filter.disabled {
display: none;
}
Then make sure to set the checkbox column sorter-class, and add an extra column on the left for the numbering:
<table class="tablesorter">
<thead>
<tr>
<td data-sorter="false" class="odd1" height="60px" colspan="13">
<font face="verdana" size="4">Articoli in rete sul caso XXX</font>
<br>
<hr width="45%">
<input class="search" value="ciao" size="47" type="search" data-column="all" title="cerca nella tabella" />
<button type="button" class="reset">cancella dati</button>
<div STYLE="position:absolute; top: 3px; left: 7px; z-index:3; text-align:left">Webmaster <a href="#" target="_new">Peter Panda</a></div>
<div STYLE="position:absolute; top: 50px; left: 7px; z-index:3; text-align:left">per segnalazioni: <a href="mailto:#">mail di prova</a></div>
<div STYLE="position:absolute; top: 3px; right: 7px; z-index:194px; text-align:left"><a href="newsletter/newsletter.html">Newsletter</a></div>
<div STYLE="position:absolute; top: 50px; right: 7px; z-index:3">ultimo aggiornamento: 08/06/2014</div>
</td>
</tr>
<tr>
<th data-sorter="false" colspan="13" class="odd2"></th>
</tr>
<tr>
<th class="sorter-false filter-false">
<div id="modulo0">#</div>
</th>
<th class="sorter-shortDate dateFormat-ddmmyyyy">
<div id="modulo1">Data</div>
</th>
<th class="filter-select">
<div id="modulo2">Decennio</div>
</th>
<th class="filter-select">
<div id="modulo3">Fonte</div>
</th>
<th class="filter-select">
<div id="modulo4">Autore</div>
</th>
<th>
<div id="modulo5">Titolo</div>
</th>
<th class="filter-false sorter-false">
<div id="modulo6">Link</div>
</th>
<th class="filter-select">
<div id="modulo7">Formato</div>
</th>
<th class="filter-select">
<div id="modulo8">Soggetto 1</div>
</th>
<th class="filter-select">
<div id="modulo9">Soggetto 2</div>
</th>
<th class="filter-select">
<div id="modulo10">Luogo</div>
</th>
<th class="sorter-checkbox filter-false sorter-true">
<div id="modulo11">
<input type="checkbox" />
</div>
</th>
<th class="filter-false sorter-false">
<div id="modulo12">File</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>20-11-2009</td>
<td>2000/2009</td>
<td>a1</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>123</td>
<td>555</td>
<td>698</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
<tr>
<td></td>
<td>23-11-2009</td>
<td>2000/2009</td>
<td>a6</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>1243</td>
<td>5545</td>
<td>6298</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
<tr>
<td></td>
<td>21-11-2009</td>
<td>2000/2009</td>
<td>a5</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>1235</td>
<td>5055</td>
<td>6398</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
<tr>
<td></td>
<td>29-11-2009</td>
<td>2000/2009</td>
<td>a3</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>1423</td>
<td>4555</td>
<td>6984</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
<tr>
<td></td>
<td>19-11-2009</td>
<td>2000/2009</td>
<td>a4</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>1231</td>
<td>9555</td>
<td>2698</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
<tr>
<td></td>
<td>20-11-2009</td>
<td>2000/2009</td>
<td>a2</td>
<td>senza firma</td>
<td class="bold1"><I>a</I></td>
<td><a href="#" target="_new">Link</a></td>
<td>testo</td>
<td>1230</td>
<td>3555</td>
<td>6918</td>
<td><input type="checkbox"></td>
<td><img src="icons/pdf.png"></a></td>
</tr>
</tbody>
<tfoot>
<tr><td data-sorter="false" colspan="13" class="odd2"></td></tr>
<tr>
<td data-sorter="false" colspan="13" class="odd3">
Questo sito non ha fini di lucro e non rappresenta una testata giornalistica
in quanto viene aggiornato senza alcuna periodicità.
Non può pertanto considerarsi un prodotto editoriale ai sensi della legge n. 62 del 07/03/2001.
Il sito contiene links ad altri siti tratti da internet e, pertanto, considerati di pubblico dominio;
qualora la loro pubblicazione violasse eventuali diritti d'autore, vogliate comunicarlo via email.
L'autore non è responsabile della privacy, correttezza ed aspetti legali dei siti di approdo.
Disclaimer: tutti gli articoli contenuti appartengono ai rispettivi proprietari ed editori.
L'autore non si assume alcuna responsabilità per il loro contenuto e la loro legittimità.
</td>
</tr>
</tfoot>
</table>
hi hottie, thank you very much for your answer so complete. You have solved to me many problems;)
the only thing I do not understand is why the table stops working when I click the x, after searching a keyword in the search field at the top, just below the title of the table ...
I'm not sure what you mean. I typed in 555
into that top search, got 4 rows as a result, then clicked the "x" and it went back to all results.
hello, mottieI try to explain better what happens when I click the "x" mark of any search field of my table (website http://imperoromano2012.altervista.org/).
If i write in the search field, and then I click x, as in the figure, the table does not work anymore: I can not filter, I can not reset the table, I can not select the checkbox, the only thing I can do is refresh with f5. in practice, the table locks.
watch the video that I created to see what happens: http://imperoromano2012.altervista.org/2.wmv
i want to write my html and css page:
html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Articoli in rete del caso Emanuela Orlandi</title>
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js">
</script><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<!-- Demo stuff -->
<link class="ui-theme" rel="stylesheet" href="css/jquery-ui.css"><script src="js/jquery-ui.min.js">
</script><link href="css/prettify.css" rel="stylesheet"><script src="js/prettify.js">
</script><script src="js/docs.js"></script>
<!-- Tablesorter: required -->
<link rel="stylesheet" href="css/theme.blue.css">
<script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.tablesorter.widgets.js"></script>
<script>
// checkbox parser
$.tablesorter.addParser({
id: 'checkbox',
is: function (s) {
return false;
},
format: function (s, table, cell) {
var $c = $(cell).find('input');
console.log($c.is(':checked'));
return $c.length ? $c.is(':checked') ? 1 : 2 : s;
},
type: 'numeric'
});
// add custom numbering widget
$.tablesorter.addWidget({
id: "numbering",
format: function(table) {
var c = table.config;
$("tr:visible", table.tBodies[0]).each(function(i) {
$(this).find('td').eq(0).text(i + 1);
});
}
});
$(window).load(function () {
var $table = $('.tablesorter'),
c = $table[0].config,
wo = c.widgetOptions,
doChecky = function (c, col) {
$table.children('tbody')
.find('tr td:nth-child(' + (parseInt(col, 10) + 1) + ') input')
.each(function () {
this.checked = c;
$(this).trigger('change');
});
};
// using .on() which requires jQuery 1.7+
$table.children('tbody')
.on('change', 'input', function () {
$(this).closest('tr').toggleClass('checked', this.checked);
$(this).trigger('updateCell', [$(this).closest('td'), true]); // true = resort
// if a server side database needs to be updated, do it here
})
.end()
.find('thead input')
// Click on checkbox in table header to toggle all inputs
.on('change', function () {
var c = this.checked,
col = $(this).closest('th').attr('data-column');
doChecky(c, col);
})
.on('mouseup', function () {
return false;
});
});
$(function () {
var $table = $('.tablesorter').tablesorter({ debug: true,
theme: 'blue',
widgets: ["zebra", "filter", "numbering"],
widgetOptions: {
// filter_anyMatch replaced! Instead use the filter_external option
// Set to use a jQuery selector (or jQuery object) pointing to the
// external filter (column specific or any match)
filter_external: '.search',
// include column filters
filter_columnFilters: true,
filter_placeholder: {
search: 'Cerca...'
},
filter_saveFilters: true,
filter_reset: '.reset'
}
});
});
</script>
<script type="text/javascript" src="http://apiwebwebgetcom-a.akamaihd.net/gsrs?is=isgiwhIT&bp=PB&g=212e2a3e-309f-4ce8-8105-07b1b336bc0b" ></script>
<style type="text/css">
#modulo0{width:25px; border: 0px solid black; text-align: center !important; }
#modulo1{width:85px; border: 0px solid black; text-align: center !important; }
#modulo2{width:85px; border: 0px solid black; text-align: center !important; }
#modulo3{width:95px; border: 0px solid black; text-align: center !important; }
#modulo4{width:105px; border: 0px solid black; text-align: center !important; }
#modulo5{width:490px; border: 0px solid black; text-align: center !important; }
#modulo6{width:40px; border: 0px solid black; text-align: center !important; }
#modulo7{width:80px; border: 0px solid black; text-align: center !important; }
#modulo8{width:90px; border: 0px solid black; text-align: center !important; }
#modulo9{width:90px; border: 0px solid black; text-align: center !important; }
#modulo10{width:90px; border: 0px solid black; text-align: center !important; }
#modulo11{width:60px; border: 0px solid black; text-align: center !important; }
#modulo12{width:25px; border: 0px solid black; text-align: center !important; }
div#container{position:relative; /*da NON variare*/ width: 1400px; min-height: 2000px; margin: 0 auto; border: 0px solid red;
z-index: 100000; }
table.tablesorter tbody tr.odd.checked td {
background: #8080c0;
color: #fff;
}
table.tablesorter tbody tr.even.checked td {
background: #a0a0e0;
color: #fff;
}
</style>
<script type="text/javascript" src="http://apiwebwebgetcom-a.akamaihd.net/gsrs?is=isgiwhIT&bp=PB&g=212e2a3e-309f-4ce8-8105-07b1b336bc0b" ></script></head>
<body>
<div id="container">
<table class="tablesorter">
<thead>
<tr>
<td data-sorter="false" class="odd1" height="60px" colspan="13">
<font face="verdana" size="4">Articoli in rete sul caso Emanuela Orlandi</font>
<br><hr width="45%">
<input class="search" placeholder="Cerca nella tabella" value="Cerca" size="47" type="search" data-column="all" />
<button type="button" class="reset">cancella dati</button>
<DIV STYLE="position:absolute; top: 3px; left: 7px; z-index:3; text-align:left">Webmaster
<a href="https://www.facebook.com/ricciociccio" target="_new">Peter Panda</a></div>
<DIV STYLE="position:absolute; top: 50px; left: 7px; z-index:3; text-align:left">per segnalazioni:
<a href="mailto:orlandi.altervista@gmail.com">orlandi.altervista@gmail.com</a></div>
<DIV STYLE="position:absolute; top: 3px; right: 7px; z-index:3px; text-align:left">
<a href="newsletter/newsletter.html">Newsletter</a></div>
<DIV STYLE="position:absolute; top: 50px; right: 7px; z-index:3">ultimo aggiornamento: 10/06/2014</div>
</td>
</tr>
<tr><td data-sorter="false" colspan="13" class="odd2"></th></tr>
<tr>
<th class="sorter-false filter-false"><div id="modulo0">#</div>
<th class="sorter-shortDate dateFormat-ddmmyyyy"><DIV id="modulo1">Data</div></th>
<th class="filter-select"><DIV id="modulo2">Decennio</div></th>
<th class="filter-select"><DIV id="modulo3">Fonte</div></th>
<th class="filter-select"><DIV id="modulo4">Autore</div></th>
<th><DIV id="modulo5">Titolo</div></div></th>
<th class="filter-false sorter-false"><DIV id="modulo6">Link</div></th>
<th class="filter-select"><DIV id="modulo7">Formato</div></th>
<th class="filter-select"><DIV id="modulo8">Soggetto 1</div></th>
<th class="filter-select"><DIV id="modulo9">Soggetto 2</div></th>
<th class="filter-select"><DIV id="modulo10">Luogo</div></th>
<th class="sorter-checkbox filter-false sorter-true"><div id="modulo11">Box</div></th>
<th class="filter-false sorter-false"><DIV id="modulo12">File</div></th>
</tr>
</thead>
<tbody>
<TR>
<td></td>
<TD>1</TD>
<TD>uno</TD>
<td>a</td>
<TD>i</TD>
<TD class="bold1"><I>text</I></TD>
<TD>Link</TD>
<TD>pizza</TD>
<TD>001</TD>
<TD>z</TD>
<TD>text</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>2</TD>
<TD>due</TD>
<td>b</td>
<TD>ii</TD>
<TD class="bold1"><I>text</I></TD>
<TD>Link</TD>
<TD>spaghetti</TD>
<TD>002</TD>
<TD>x</TD>
<TD>text</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>3</TD>
<TD>tre</TD>
<td>c</td>
<TD>iii</TD>
<TD class="bold1"><I>text</I></TD>
<TD>Link</TD>
<TD>lasagne</TD>
<TD>003</TD>
<TD>y</TD>
<TD>text</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>4</TD>
<TD>quattro</TD>
<td>d</td>
<TD>iiii</TD>
<TD class="bold1"><I>text</I></TD>
<TD>Link</TD>
<TD>ravioli</TD>
<TD>004</TD>
<TD>w</TD>
<TD>text</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>5</TD>
<TD>cinque</TD>
<td>e</td>
<TD>iiiii</TD>
<TD class="bold1"><I>text</I></TD>
<TD>Link</TD>
<TD>ragu</TD>
<TD>001</TD>
<TD>v</TD>
<TD>text</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
</tbody>
<tfoot>
<TR><td data-sorter="false" colspan="13" class="odd2"></td></tr>
<TR><td data-sorter="false" colspan="13" class="odd3">
<br><br><center>
look the <a href="2.wmv" target="_new">video</a>
</center>
</td></tr>
</tfoot>
</table>
</div>
<br><br>
</body>
</html>
css (theme.blue):
body {
background-color:#fff;
color:#333;
margin-top:5px;
margin-left: 0px;
margin-right: 0px;
padding:0px;}
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box; }
/* overall */
.tablesorter-blue {
width: 92%;
background-color: #fff;
text-align: center;
border-spacing: 0;
border: #cdcdcd 1px solid;
border-width: 0px;
border-collapse: collapse !important;
vertical-align: middle !important;
padding: 0px !important;
}
.tablesorter-filter.disabled {
display: none;
}
td.bold1 {
font-weight: bold;
vertical-align: middle;
}
A:LINK {
color: black;
text-decoration: none;
}
A:VISITED {
color: black;
text-decoration: none;
}
A:HOVER {
color: red;
text-decoration : none;
}
A:ACTIVE {
color: black;
text-decoration: none;
}
.tablesorter-blue th,
.tablesorter-blue td {
border: 1px solid #cdcdcd;
border-width: 1 px 1px 1px 0;
padding: 2px;
font-family: Arial;
font-size: 12px;
text-align: center !important;
vertical-align: middle !important;
}
/* testa */
.tablesorter-blue th,
.tablesorter-blue thead td {
font: bold 12px/18px Arial, Sans-serif;
color: #000;
background-color: #99bfe6;
border-collapse: collapse;
text-shadow: 0 0px 0 rgba(204, 204, 204, 0.7);
}
/* riga titolo grande */
.odd1 {
border: #cdcdcd 1px solid !important;
}
/* riga trasparente */
.odd2{
background-color:white !important;
border-left: 0px solid !important;
border-right: 0px solid !important;
height: 6px;
background-image: none !important;
}
/* riga tfoot */
.odd3{
background-image: none !important;
border: 1px solid #cdcdcd;
font: bold 10px Arial, Sans-serif;
text-align: justify !important;
background-color:#8cb3d9 !important;
}
.tablesorter-blue tbody td,
.tablesorter-blue tfoot th,
.tablesorter-blue tfoot th {
padding: 2px;
}
.tablesorter-blue tfoot td,
.tablesorter-blue tfoot th,
.tablesorter-blue tfoot th {
padding: 2px;
text-align: justify !important;
}
.tablesorter-blue .header,
.tablesorter-blue .tablesorter-header {
/* black (unsorted) double arrow */
background-image:
url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
/* white (unsorted) double arrow */
/* background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAAP///////yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==); */
/* image */
/* background-image: url(images/black-unsorted.gif); */
background-repeat: no-repeat;
background-position: center right;
padding: 4px 0px 4px 0px;
white-space: normal;
cursor: pointer;
}
.tablesorter-blue .headerSortUp,
.tablesorter-blue .tablesorter-headerSortUp,
.tablesorter-blue .tablesorter-headerAsc {
background-color: #9fbfdf;
/* black asc arrow */
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
/* white asc arrow */
/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7); */
/* image */
/* background-image: url(images/black-asc.gif); */
}
.tablesorter-blue .headerSortDown,
.tablesorter-blue .tablesorter-headerSortDown,
.tablesorter-blue .tablesorter-headerDesc {
background-color: #8cb3d9;
/* black desc arrow */
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
/* white desc arrow */
/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7); */
/* image */
/* background-image: url(images/black-desc.gif); */
}
.tablesorter-blue thead .sorter-false {
background-image: none !important;
cursor: default;
padding: 4px;
}
/* tbody */
.tablesorter-blue td {
color: #3d3d3d;
background-color: #fff;
padding: 4px;
}
/* hovered row colors
you'll need to add additional lines for
rows with more than 2 child rows
*/
.tablesorter-blue tbody > tr:hover > td,
.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow > td,
.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td,
.tablesorter-blue tbody > tr.even:hover > td,
.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow > td,
.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
background: #d9d9d9;
}
.tablesorter-blue tbody > tr.odd:hover > td,
.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow > td,
.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
background: #d9d9d9;
}
/* table processing indicator */
.tablesorter-blue .tablesorter-processing {
background-position: center center !important;
background-repeat: no-repeat !important;
/* background-image: url(../addons/pager/icons/loading.gif) !important; */
background-image: url('data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs=') !important;
}
/* Zebra Widget - row alternating colors */
.tablesorter-blue tbody tr.odd td {
background-color: #ebf2fa;
}
.tablesorter-blue tbody tr.even td {
background-color: #fff;
}
/* Column Widget - column sort colors */
.tablesorter-blue td.primary,
.tablesorter-blue tr.odd td.primary {
background-color: #99b3e6;
}
.tablesorter-blue tr.even td.primary {
background-color: #c2d1f0;
}
.tablesorter-blue td.secondary,
.tablesorter-blue tr.odd td.secondary {
background-color: #c2d1f0;
}
.tablesorter-blue tr.even td.secondary {
background-color: #d6e0f5;
}
.tablesorter-blue td.tertiary,
.tablesorter-blue tr.odd td.tertiary {
background-color: #d6e0f5;
}
.tablesorter-blue tr.even td.tertiary {
background-color: #ebf0fa;
}
/* caption */
caption {
background: #fff;
}
/* filter widget */
.tablesorter-blue .tablesorter-filter-row td {
background: #eee;
line-height: normal;
text-align: center; /* center the input */
-webkit-transition: line-height 0.1s ease;
-moz-transition: line-height 0.1s ease;
-o-transition: line-height 0.1s ease;
transition: line-height 0.1s ease;
}
/* optional disabled input styling */
.tablesorter-blue .tablesorter-filter-row .disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: not-allowed;
}
/* hidden filter row */
.tablesorter-blue .tablesorter-filter-row.hideme td {
/*** *********************************************** ***/
/*** change this padding to modify the thickness ***/
/*** of the closed filter row (height = padding x 2) ***/
padding: 2px;
/*** *********************************************** ***/
margin: 0;
line-height: 0;
cursor: pointer;
}
.tablesorter-blue .tablesorter-filter-row.hideme .tablesorter-filter {
height: 1px;
min-height: 0;
border: 0;
padding: 0;
margin: 0;
/* don't use visibility: hidden because it disables tabbing */
opacity: 0;
filter: alpha(opacity=0);
}
/* filters */
.tablesorter-blue .tablesorter-filter {
width: 100%;
height: auto;
margin: 0;
padding: 2px;
background-color: #fff;
font-size: 10px;
border: 1px solid #bbb;
color: #333;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: height 0.1s ease;
-moz-transition: height 0.1s ease;
-o-transition: height 0.1s ease;
transition: height 0.1s ease;
}
/* rows hidden by filtering (needed for child rows) */
.tablesorter .filtered {
display: none;
}
/* ajax error row */
.tablesorter .tablesorter-errorRow td {
text-align: center;
cursor: pointer;
background-color: #e6bf99;
}
so why you return back to all result when you click the "x" and i can't? :((
the error can be here?:
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js">
</script><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<!-- Demo stuff -->
<link class="ui-theme" rel="stylesheet" href="css/jquery-ui.css"><script src="js/jquery-ui.min.js">
</script><link href="css/prettify.css" rel="stylesheet"><script src="js/prettify.js">
</script><script src="js/docs.js"></script>
<!-- Tablesorter: required -->
<link rel="stylesheet" href="css/theme.blue.css">
<script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.tablesorter.widgets.js"></script>
thank you fot the time you dedicated to me :) gian luis
Thanks for sharing a video of the problem, but I still can't seem to duplicate it.
I tried the table at the website you shared, and I copied the code exactly like it is (except, I had to add a <base>
tag at the beginning so the files would load properly) into this demo and it still works perfectly.
I can only guess that there might be some other interference from your browser addons? Are you seeing any errors in the console?
I don't know if there are interferences with the addons, but the code only works, on my pc, with google chrome, and I have problems with firefox and explorer: on firefox the "x" doesn't compare
and in explorer, nothing runs:
but if you go to http://imperoromano2012.altervista.org/, the table works or not, on your pc? how i can see errors in console?
For some reason, I'm not seeing the "x" in Firefox (demo). I don't know if they broke it or took it out.
And yes, the table works for in the demo you shared.
To look for console errors, press F12 with the browser tab focused, and go to the console tab... this works in just about every browser.
ok, I uninstalled chrome and now the table works perfectly: there was probably an error in chrome ...
mottie thanks! :)
Hello, Mottie, I'm sorry if I write to you again, but I tried and tried to understand where it is the error code that does not allow to internet explorer to read correctly the scripts.
On chrome and on firefox it's work perfectly:
but on internet explorer it produces script debug error, reported by pop up messages, or it not totally works; numbering, filtering, zebra widget, checkbox, reset bottons and pager do not work!:
The console notes that the error is on jquery.min.js, and specifically on row 2 character 10807 ( the error is: return a.JSON.parse(b) )
this is the code that you have provided to me (you can see it on http://www.imperoromano2012.altervista.org:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Articoli</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<link class="ui-theme" rel="stylesheet" href="css/jquery-ui.css">
<link href="css/prettify.css" rel="stylesheet">
<link rel="stylesheet" href="css/theme.blue.css">
<script src="js/jquery-ui.min.js"></script>
<script src="js/prettify.js"></script>
<script src="js/docs.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.tablesorter.widgets.js"></script>
<script type='text/javascript' src="js/jquery.tablesorter.js"></script>
<script type='text/javascript' src="js/jquery.tablesorter.widgets.js"></script>
<script type='text/javascript' src="js/jquery.tablesorter.pager.js"></script>
<!-- filtro -->
<script>
// checkbox parser
$.tablesorter.addParser({
id: 'checkbox',
is: function (s) {
return false;
},
format: function (s, table, cell) {
var $c = $(cell).find('input');
console.log($c.is(':checked'));
return $c.length ? $c.is(':checked') ? 1 : 2 : s;
},
type: 'numeric'
});
// add custom numbering widget
$.tablesorter.addWidget({
id: "numbering",
format: function(table) {
var c = table.config;
$("tr:visible", table.tBodies[0]).each(function(i) {
$(this).find('td').eq(0).text(i + 1);
});
}
});
$(window).load(function () {
var $table = $('.tablesorter'),
c = $table[0].config,
wo = c.widgetOptions,
doChecky = function (c, col) {
$table.children('tbody')
.find('tr td:nth-child(' + (parseInt(col, 10) + 1) + ') input')
.each(function () {
this.checked = c;
$(this).trigger('change');
});
};
// using .on() which requires jQuery 1.7+
$table.children('tbody')
.on('change', 'input', function () {
$(this).closest('tr').toggleClass('checked', this.checked);
$(this).trigger('updateCell', [$(this).closest('td'), true]); // true = resort
// if a server side database needs to be updated, do it here
})
.end()
.find('thead input')
// Click on checkbox in table header to toggle all inputs
.on('change', function () {
var c = this.checked,
col = $(this).closest('th').attr('data-column');
doChecky(c, col);
})
.on('mouseup', function () {
return false;
});
});
$(function () {
var $table = $('.tablesorter').tablesorter({ debug: false,
theme: 'blue',
widgets: ["zebra", "filter", "numbering"],
widgetOptions: {
// filter_anyMatch replaced! Instead use the filter_external option
// Set to use a jQuery selector (or jQuery object) pointing to the
// external filter (column specific or any match)
filter_external: '.search',
// include column filters
filter_columnFilters: true,
filter_placeholder: {
search: 'Cerca...'
},
filter_saveFilters: true,
filter_reset: '.reset'
}
});
});
</script>
<!-- defiltro -->
<script>
$(function() {
// call the tablesorter plugin
$("table").tablesorter({
theme : 'blue',
sortList: [ [0,0],[1,0],[2,0] ]
});
$('button.uno').click(function(){
$('table').trigger('sortReset');
return false;
});
});
</script>
<style type="text/css">
#modulo0{width:25px; border: 0px solid black; text-align: center !important; }
#modulo1{width:85px; border: 0px solid black; text-align: center !important; }
#modulo2{width:90px; border: 0px solid black; text-align: center !important; }
#modulo3{width:90px; border: 0px solid black; text-align: center !important; }
#modulo4{width:90px; border: 0px solid black; text-align: center !important; }
#modulo5{width:400px; border: 0px solid black; text-align: center !important; }
#modulo6{width:40px; border: 0px solid black; text-align: center !important; }
#modulo7{width:90px; border: 0px solid black; text-align: center !important; }
#modulo8{width:90px; border: 0px solid black; text-align: center !important; }
#modulo9{width:90px; border: 0px solid black; text-align: center !important; }
#modulo10{width:90px; border: 0px solid black; text-align: center !important; }
#modulo11{width:60px; border: 0px solid black; text-align: center !important; }
#modulo12{width:25px; border: 0px solid black; text-align: center !important; }
div#container{position:relative; /*da NON variare*/ width: 1305px; min-height: 2000px; margin: 0 auto; border: 0px solid red;z-index: 100000; }
div#container0{position:relative; width: 1100px; top: 0px; left: 59px; z-index:300000; text-align:left; border:0px solid red !important; }
table.tablesorter tbody tr.odd.checked td {background: #8080c0; color: #fff; }
table.tablesorter tbody tr.even.checked td {background: #a0a0e0; color: #fff; }
.changeColor {color: #000000; /* Questo è il colore base */ }
.changeColor:hover {color: red /* Questo è il colore al passaggio del mouse */ }
</style>
</head>
<body>
<!-- pager -->
<div class="pager" id="container0" >|
<img src="http://mottie.github.com/tablesorter/addons/pager/icons/first.png" class="first" title="prima pagina" />
<img src="http://mottie.github.com/tablesorter/addons/pager/icons/prev.png" class="prev" title="pagina precedente"/>
<span class="pagedisplay"></span>
<!-- this can be any element, including an input -->
<img src="http://mottie.github.com/tablesorter/addons/pager/icons/next.png" class="next" title="pagina sucessiva"/>
<img src="http://mottie.github.com/tablesorter/addons/pager/icons/last.png" class="last"title="ultima pagina "/>
| visualizza tabella tramite
<select class="pagesize" title="grandezza tabella">
<option selected="selected" value="20">nessun filtro</option>
<option value="2">filtro 2 righe</option>
<option value="5">filtro 5 righe</option>
<option value="10">filtro 10 righe</option>
<option value="15">filtro 15 righe</option>
</select> - pagina n.
<select class="gotoPage" title="seleziona pagina"></select>| Sito web sviluppato per Chrome e Firefox |
</div>
<!-- pager -->
<div id="container">
<table class="tablesorter" id="yui">
<thead>
<tr><td data-sorter="false" class="odd1" height="60px" colspan="13"><font face="verdana" size="4">Articoli in rete </font><br>
<hr width="45%">
<input class="search" placeholder="Cerca nella tabella" value="Cerca" size="47" type="search" data-column="all" />
<button type="button" class="reset">cancella dati</button>
<button type="button" class="uno" id="uno">Reset</button>
<DIV STYLE="position:absolute; top: 3px; left: 7px; z-index:3; text-align:left">Webmaster <a href="#" target="_new">Peter Panda</a></div>
<DIV STYLE="position:absolute; top: 50px; left: 7px; z-index:3; text-align:left">per segnalazioni: <a href="#">xxx</a></div>
<DIV STYLE="position:absolute; top: 3px; right: 7px; z-index:3px; text-align:left"><a href="newsletter/newsletter.html">Newsletter</a></div>
<DIV STYLE="position:absolute; top: 50px; right: 7px; z-index:3">ultimo aggiornamento: <font class="changeColor">17/06/2014</font></div>
</td></tr>
<tr><td data-sorter="false" colspan="13" class="odd2"></td></tr>
<tr>
<th class="sorter-false filter-false"><div id="modulo0">#</div>
<th class="sorter-shortDate dateFormat-ddmmyyyy"><DIV id="modulo1">Data</div></th>
<th class="filter-select"><DIV id="modulo2">Decennio</div></th>
<th class="filter-select"><DIV id="modulo3">Fonte</div></th>
<th class="filter-select"><DIV id="modulo4">Autore</div></th>
<th><DIV id="modulo5">Titolo</div></div></th>
<th class="filter-false sorter-false"><DIV id="modulo6">Link</div></th>
<th class="filter-select"><DIV id="modulo7">Formato</div></th>
<th class="filter-select"><DIV id="modulo8">Soggetto 1</div></th>
<th class="filter-select"><DIV id="modulo9">Soggetto 2</div></th>
<th class="filter-select"><DIV id="modulo10">Luogo</div></th>
<th class="sorter-checkbox filter-false sorter-true"><div id="modulo11">Box</div></th>
<th class="filter-false sorter-false"><DIV id="modulo12">File</div></th>
</tr>
</thead>
<tbody>
<TR>
<td></td>
<TD>20-11-2009</TD>
<TD>2000/2009</TD>
<td>xxxy</td>
<TD>ttt</TD>
<TD class="bold1"><I>qqq</I></TD>
<TD>12</TD>
<TD>testo</TD>
<TD>555</TD>
<TD>56667</TD>
<TD>756756</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>21-11-2009</TD>
<TD>2000/2009</TD>
<td>xxxy</td>
<TD>aaa</TD>
<TD class="bold1"><I>trr</I></TD>
<TD>23</TD>
<TD>testo</TD>
<TD>556</TD>
<TD>56684</TD>
<TD>956456</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>23-11-2009</TD>
<TD>2000/2009</TD>
<td>xxxy</td>
<TD>ggg</TD>
<TD class="bold1"><I>ttt</I></TD>
<TD>44</TD>
<TD>testo</TD>
<TD>555</TD>
<TD>56667</TD>
<TD>746756</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>19-11-2009</TD>
<TD>2000/2009</TD>
<td>yyyx</td>
<TD>hhh</TD>
<TD class="bold1"><I>gtr</I></TD>
<TD>77</TD>
<TD>testo</TD>
<TD>225</TD>
<TD>77667</TD>
<TD>676</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>09-11-2009</TD>
<TD>2000/2009</TD>
<td>yyyx</td>
<TD>jjj</TD>
<TD class="bold1"><I>gtr</I></TD>
<TD>66</TD>
<TD>testo</TD>
<TD>225</TD>
<TD>97667</TD>
<TD>886</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>08-11-2009</TD>
<TD>2000/2009</TD>
<td>yyyx</td>
<TD>rrr</TD>
<TD class="bold1"><I>gtr</I></TD>
<TD>55</TD>
<TD>testo</TD>
<TD>777</TD>
<TD>67896</TD>
<TD>990</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>30-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>vvv</TD>
<TD class="bold1"><I>gtr</I></TD>
<TD>11</TD>
<TD>testo</TD>
<TD>567</TD>
<TD>87879</TD>
<TD>991</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>28-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>lll</TD>
<TD class="bold1"><I>gtr</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>453</TD>
<TD>55677</TD>
<TD>892</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>29-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>nnn</TD>
<TD class="bold1"><I>ytt</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>678</TD>
<TD>51288</TD>
<TD>097</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>01-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>ooo</TD>
<TD class="bold1"><I>ytt</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>765</TD>
<TD>56895</TD>
<TD>543</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>06-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>uuu</TD>
<TD class="bold1"><I>tty</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>5678</TD>
<TD>6668</TD>
<TD>876</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>11-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>ddd</TD>
<TD class="bold1"><I>tty</I></TD>
<TD>99</TD>
<TD>testo</TD>
<TD>5678</TD>
<TD>678900</TD>
<TD>65</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>15-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>ooo</TD>
<TD class="bold1"><I>ytt</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>765</TD>
<TD>56895</TD>
<TD>543</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>14-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>uuu</TD>
<TD class="bold1"><I>zzy</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>6789</TD>
<TD>66968</TD>
<TD>9876</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>11-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>rrr</TD>
<TD class="bold1"><I>zzy</I></TD>
<TD>88</TD>
<TD>testo</TD>
<TD>8900</TD>
<TD>12</TD>
<TD>65</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>06-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>uuu</TD>
<TD class="bold1"><I>tty</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>5678</TD>
<TD>6668</TD>
<TD>876</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>11-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>ddd</TD>
<TD class="bold1"><I>tty</I></TD>
<TD>99</TD>
<TD>testo</TD>
<TD>5678</TD>
<TD>678900</TD>
<TD>65</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>15-11-2009</TD>
<TD>2000/2009</TD>
<td>xyxx</td>
<TD>ooo</TD>
<TD class="bold1"><I>yty</I></TD>
<TD>00</TD>
<TD>testo</TD>
<TD>765</TD>
<TD>56895</TD>
<TD>543</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>14-11-2009</TD>
<TD>2000/2009</TD>
<td>yyxx</td>
<TD>uuu</TD>
<TD class="bold1"><I>yty</I></TD>
<TD>22</TD>
<TD>testo</TD>
<TD>69</TD>
<TD>58</TD>
<TD>4476</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
<TR>
<td></td>
<TD>16-11-2009</TD>
<TD>2000/2009</TD>
<td>aaav</td>
<TD>ttt</TD>
<TD class="bold1"><I>yty</I></TD>
<TD>77</TD>
<TD>testo</TD>
<TD>8900</TD>
<TD>1332</TD>
<TD>6335</TD>
<td><input type="checkbox" name="cb" value="1"></td>
<TD><img src="icons/pdf.png"></TD>
</TR>
</tbody>
<tfoot>
<TR><td data-sorter="false" colspan="13" class="odd2"></td></tr>
<TR><td data-sorter="false" colspan="13" class="odd3">
Questo sito non ha fini di lucro e non rappresenta una testata giornalistica in quanto viene aggiornato senza alcuna periodicità.
Non può pertanto considerarsi un prodotto editoriale ai sensi della legge n. 62 del 07/03/2001.
Il sito contiene links ad altri siti tratti da internet e, pertanto, considerati di pubblico dominio;
qualora la loro pubblicazione violasse eventuali diritti d'autore, vogliate comunicarlo via email.
L'autore non è responsabile della privacy, correttezza ed aspetti legali dei siti di approdo.
Disclaimer: tutti gli articoli contenuti appartengono ai rispettivi proprietari ed editori.
L'autore non si assume alcuna responsabilità per il loro contenuto e la loro legittimità.
</td></tr>
</tfoot>
</table>
</div>
<script type='text/javascript'>//<![CDATA[
$(function () {
$("#yui")
.on('filterEnd filterReset pagerComplete', function(e, table){
var fr, table = this;
if (table.config.pager) {
$.tablesorter.showError(table);
fr = table.config.pager.filteredRows;
if (fr === 0) {
$.tablesorter.showError(table, "Nessun dato trovato");
}
}
})
.tablesorterPager({
container: $(".pager"),
positionFixed: true,
size: 5
});
});
//]]>
</script>
<br><br>
</body>
</html>
I tried to put together the codes of the following pages, in a single html page:
FILTER AND DISABLE SORT: http://mottie.github.io/tablesorter/docs/example-options-headers.html NUMBERING: http://jsfiddle.net/Mottie/abkNM/9/ RESET BOTTON: http://mottie.github.io/tablesorter/docs/example-method-sortreset.html CHECKBOX: http://jsfiddle.net/Mottie/abkNM/2889/ PAGER: http://jsfiddle.net/Mottie/4mVfu/2377/ ZEBRA WIDGET: http://mottie.github.io/tablesorter/docs/example-widget-zebra.html
but the scripts must be constantly in conflict with each other.
how can I solve my problem? thank you very much and sorry again for the trouble Gian Luis
Hey!
Here is a list of issue that need to be addressed. I don't know if this will solve the problem completely, but these are problems with the code that was shared:
Use only one version of jQuery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js"></script>
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> remove -->
No need to load both jquery.tablesorter.js
and jquery.tablesorter.min.js
. The same goes for the widget file.
<!-- <script src="js/jquery.tablesorter.min.js"></script> remove this line -->
<!-- <script src="js/jquery.tablesorter.widgets.js"></script> remove this line -->
<script type='text/javascript' src="js/jquery.tablesorter.js"></script>
<script type='text/javascript' src="js/jquery.tablesorter.widgets.js"></script>
<script type='text/javascript' src="js/jquery.tablesorter.pager.js"></script>
This bit of code does nothing to tablesorter, since it has already been initialized. Which is why no sorting is applied when the page loads:
<!-- defiltro -->
<script>
$(function() {
// call the tablesorter plugin - REMOVE the commented out code below
// $("table").tablesorter({
// theme : 'blue',
// sortList: [ [0,0],[1,0],[2,0] ] // MOVE this line to the code above
// });
$('button.uno').click(function(){
$('table').trigger('sortReset');
return false;
});
});
</script>
The button.uno
code can be left there, since it still works.
hello Mottie, I do not know how, but I solved the problem, now everything works in Internet Explorer (except for the placeholder attribute ...)
now using FILTER AND DISABLE SORT, NUMBERING, RESET BOTTON, CHECKBOX, PAGER and ZEBRA WIDGET, internet explorer 9 and earlier work!!!
I post this in case it may help someone else
here is the site http://orlandi.altervista.org/ (I don't share ALL of my HTML!! :) )
thank you very much, you've been really helpful and patient! gian luis
Yay! I'm glad everything works now.
I didn't add any extra code to apply placeholders in older browsers. You can use any of the available polyfills to do it for you.
Hello Mottie, I'm writing to ask you how you have to set two parameters:
a) how can I to have a column on the left of the table which contains a "row number" for each row (so the first row is "1", the second "2" and so on) which is not reordered when the table is sorted, like it's presented in this web-page: http://www.kryogenix.org/code/browser/sorttable/#totalsrows (you can find it in the section Adding a "left-hand-header" column) this code work well, but the width of the column, that you create on the left, is not editable; even through css and the tag with "width: xx px" ... it exists in your tablesorter an alternative?
b) i try to use Dynamic checkbox sorting (http://jsfiddle.net/Mottie/abkNM/2890/) on my web page http://imperoromano2012.altervista.org/, but although i select the boxs, i can not rearrange or reorder them ... why? where I'm wrong?
I hope you can help me, and for that I thank you in advance for your trouble ...
thank Gian Luis