Parser: input-select parser no longer binds to non-tablesorter tables. Fixes #633

This commit is contained in:
Mottie 2014-05-28 15:46:18 -05:00
parent f932d2687e
commit 5ce66aebfe
2 changed files with 9 additions and 6 deletions

View File

@ -522,7 +522,7 @@
<ul>
<li><a href="example-parsers-dates.html">Assorted date parsers</a> (<span class="version">v2.8</span>; <span class="version updated">v2.14</span>; includes weekday, month, two-digit year &amp; <a href="http://sugarjs.com/dates">sugar.js</a> date parsers).</li>
<li><a href="example-parsers-ignore-articles.html">Ignore leading articles parser</a> (Ignore &quot;A&quot;, &quot;An&quot; and &quot;The&quot; in titles) (<span class="version">v2.8</span>).</li>
<li><a href="example-widget-grouping.html">Input/select parsers</a> (used by Grouping rows widget) (<span class="version">v2.8</span>; <span class="version updated">v2.16.2</span>).</li>
<li><a href="example-widget-grouping.html">Input/select parsers</a> (used by Grouping rows widget) (<span class="version">v2.8</span>; <span class="version updated">v2.17.1</span>).</li>
<li><a href="example-parsers-metric.html">Metric parser</a> (<span class="version">v2.8</span>).</li>
<li><a href="example-parsers-feet-inch-fraction.html">Feet-inch-fraction parser</a> (<span class="version">v2.8</span>).</li>
<li><a href="example-parsers-ip-address.html">IPv6 address parser</a> (<span class="version">v2.12</span>).</li>

View File

@ -71,17 +71,20 @@
$(window).load(function(){
// this flag prevents the updateCell event from being spammed
// it happens when you modify input text and hit enter
var alreadyUpdating = false;
$('table').find('tbody').on('change', 'select, input', function(e){
var alreadyUpdating = false,
t = $.tablesorter.css.table || 'tablesorter';
// bind to .tablesorter (default class name)
$('.' + t).find('tbody').on('change', 'select, input', function(e){
if (!alreadyUpdating) {
var $tar = $(e.target),
$cell = $tar.closest('td'),
$table = $cell.closest('table'),
indx = $cell[0].cellIndex,
c = $table[0].config,
c = $table[0].config || false,
$hdr = c && c.$headers && c.$headers.eq(indx);
// don't use updateCell if column is set to "sorter-false" and "filter-false"
if ($hdr.length && $hdr.hasClass('sorter-false') && $hdr.hasClass('filter-false')){
// abort if not a tablesorter table, or
// don't use updateCell if column is set to "sorter-false" and "filter-false", or column is set to "parser-false"
if ( !c || ( $hdr && $hdr.length && ( $hdr.hasClass('parser-false') || ($hdr.hasClass('sorter-false') && $hdr.hasClass('filter-false')) ) ) ){
return false;
}
alreadyUpdating = true;