mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Core & editable: ensure table initialized before using updateCell. See #1099
This commit is contained in:
parent
aa79c1d4a1
commit
5494d79953
2
dist/js/widgets/widget-editable.min.js
vendored
2
dist/js/widgets/widget-editable.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1219,6 +1219,12 @@
|
||||
},
|
||||
|
||||
updateCell : function( c, cell, resort, callback ) {
|
||||
if ( ts.isEmptyObject( c.cache ) ) {
|
||||
// empty table, do an update instead - fixes #1099
|
||||
ts.updateHeader( c );
|
||||
ts.commonUpdate( c, resort, callback );
|
||||
return;
|
||||
}
|
||||
c.table.isUpdating = true;
|
||||
c.$table.find( c.selectorRemove ).remove();
|
||||
// get position from the dom
|
||||
|
@ -222,17 +222,20 @@
|
||||
.data( 'before', valid )
|
||||
.data( 'original', valid )
|
||||
.trigger( 'change' );
|
||||
$.tablesorter.updateCell( c, $this.closest( 'td' ), false, function() {
|
||||
if ( wo.editable_autoResort ) {
|
||||
setTimeout( function() {
|
||||
$.tablesorter.sortOn( c, c.sortList, function() {
|
||||
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ), true );
|
||||
}, true );
|
||||
}, 10 );
|
||||
} else {
|
||||
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ) );
|
||||
}
|
||||
});
|
||||
// prevent error if table was destroyed - see #1099
|
||||
if ( c.table.hasInitialized ) {
|
||||
$.tablesorter.updateCell( c, $this.closest( 'td' ), false, function() {
|
||||
if ( wo.editable_autoResort ) {
|
||||
setTimeout( function() {
|
||||
$.tablesorter.sortOn( c, c.sortList, function() {
|
||||
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ), true );
|
||||
}, true );
|
||||
}, 10 );
|
||||
} else {
|
||||
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else if ( !valid && e.type !== 'keydown' ) {
|
||||
|
Loading…
Reference in New Issue
Block a user