Core & editable: ensure table initialized before using updateCell. See #1099

This commit is contained in:
Rob Garrison 2015-12-10 23:03:34 -06:00
parent aa79c1d4a1
commit 5494d79953
3 changed files with 21 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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' ) {