Filter: restore triggered change namespace & prevent search before init. Fixes #1002

This commit is contained in:
Mottie 2015-08-27 07:13:46 -05:00
parent 3282dc52fc
commit 7756fdf9a2
10 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 08-26-2015 (v2.23.2)*/ /*! tablesorter (FORK) - updated 08-27-2015 (v2.23.2)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -29,7 +29,6 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter * @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/ */
/*jshint browser:true, jquery:true, unused:false, expr: true */ /*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false */
;(function($){ ;(function($){
'use strict'; 'use strict';
$.extend({ $.extend({
@ -3468,8 +3467,8 @@
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( event.which === 13 || event.type === 'search' || if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' ||
event.type === 'change' && this.value !== c.lastSearch[column] ) { event.type === 'change' && this.value !== c.lastSearch[column] ) ) {
event.preventDefault(); event.preventDefault();
// init search with no delay // init search with no delay
$( this ).attr( 'data-lastSearchTime', new Date().getTime() ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
@ -4315,7 +4314,8 @@
} }
$column $column
.val( setFilters[ i ] ) .val( setFilters[ i ] )
.trigger( 'change' ); // must include a namespace here; but not c.namespace + 'filter'?
.trigger( 'change' + c.namespace );
} else { } else {
filters[i] = $column.val() || ''; filters[i] = $column.val() || '';
// don't change the first... it will move the cursor // don't change the first... it will move the cursor

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,6 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter * @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/ */
/*jshint browser:true, jquery:true, unused:false, expr: true */ /*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false */
;(function($){ ;(function($){
'use strict'; 'use strict';
$.extend({ $.extend({

View File

@ -1,4 +1,4 @@
/*! tablesorter (FORK) - updated 08-26-2015 (v2.23.2)*/ /*! tablesorter (FORK) - updated 08-27-2015 (v2.23.2)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -1126,8 +1126,8 @@
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( event.which === 13 || event.type === 'search' || if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' ||
event.type === 'change' && this.value !== c.lastSearch[column] ) { event.type === 'change' && this.value !== c.lastSearch[column] ) ) {
event.preventDefault(); event.preventDefault();
// init search with no delay // init search with no delay
$( this ).attr( 'data-lastSearchTime', new Date().getTime() ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
@ -1973,7 +1973,8 @@
} }
$column $column
.val( setFilters[ i ] ) .val( setFilters[ i ] )
.trigger( 'change' ); // must include a namespace here; but not c.namespace + 'filter'?
.trigger( 'change' + c.namespace );
} else { } else {
filters[i] = $column.val() || ''; filters[i] = $column.val() || '';
// don't change the first... it will move the cursor // don't change the first... it will move the cursor

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 08-26-2015 (v2.23.2)*/ /*! tablesorter (FORK) - updated 08-27-2015 (v2.23.2)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -35,7 +35,6 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter * @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/ */
/*jshint browser:true, jquery:true, unused:false, expr: true */ /*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false */
;(function($){ ;(function($){
'use strict'; 'use strict';
$.extend({ $.extend({
@ -3474,8 +3473,8 @@
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( event.which === 13 || event.type === 'search' || if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' ||
event.type === 'change' && this.value !== c.lastSearch[column] ) { event.type === 'change' && this.value !== c.lastSearch[column] ) ) {
event.preventDefault(); event.preventDefault();
// init search with no delay // init search with no delay
$( this ).attr( 'data-lastSearchTime', new Date().getTime() ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
@ -4321,7 +4320,8 @@
} }
$column $column
.val( setFilters[ i ] ) .val( setFilters[ i ] )
.trigger( 'change' ); // must include a namespace here; but not c.namespace + 'filter'?
.trigger( 'change' + c.namespace );
} else { } else {
filters[i] = $column.val() || ''; filters[i] = $column.val() || '';
// don't change the first... it will move the cursor // don't change the first... it will move the cursor

View File

@ -17,7 +17,6 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter * @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/ */
/*jshint browser:true, jquery:true, unused:false, expr: true */ /*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false */
;(function($){ ;(function($){
'use strict'; 'use strict';
$.extend({ $.extend({

View File

@ -4,7 +4,7 @@
*/ */
/*! tablesorter (FORK) - updated 08-26-2015 (v2.23.2)*/ /*! tablesorter (FORK) - updated 08-27-2015 (v2.23.2)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */ /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
@ -1132,8 +1132,8 @@
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( event.which === 13 || event.type === 'search' || if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' ||
event.type === 'change' && this.value !== c.lastSearch[column] ) { event.type === 'change' && this.value !== c.lastSearch[column] ) ) {
event.preventDefault(); event.preventDefault();
// init search with no delay // init search with no delay
$( this ).attr( 'data-lastSearchTime', new Date().getTime() ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
@ -1979,7 +1979,8 @@
} }
$column $column
.val( setFilters[ i ] ) .val( setFilters[ i ] )
.trigger( 'change' ); // must include a namespace here; but not c.namespace + 'filter'?
.trigger( 'change' + c.namespace );
} else { } else {
filters[i] = $column.val() || ''; filters[i] = $column.val() || '';
// don't change the first... it will move the cursor // don't change the first... it will move the cursor

View File

@ -758,8 +758,8 @@
// don't get cached data, in case data-column changes dynamically // don't get cached data, in case data-column changes dynamically
var column = parseInt( $( this ).attr( 'data-column' ), 10 ); var column = parseInt( $( this ).attr( 'data-column' ), 10 );
// don't allow 'change' event to process if the input value is the same - fixes #685 // don't allow 'change' event to process if the input value is the same - fixes #685
if ( event.which === 13 || event.type === 'search' || if ( wo.filter_initialized && ( event.which === 13 || event.type === 'search' ||
event.type === 'change' && this.value !== c.lastSearch[column] ) { event.type === 'change' && this.value !== c.lastSearch[column] ) ) {
event.preventDefault(); event.preventDefault();
// init search with no delay // init search with no delay
$( this ).attr( 'data-lastSearchTime', new Date().getTime() ); $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
@ -1605,7 +1605,8 @@
} }
$column $column
.val( setFilters[ i ] ) .val( setFilters[ i ] )
.trigger( 'change' ); // must include a namespace here; but not c.namespace + 'filter'?
.trigger( 'change' + c.namespace );
} else { } else {
filters[i] = $column.val() || ''; filters[i] = $column.val() || '';
// don't change the first... it will move the cursor // don't change the first... it will move the cursor