Add scrollOnAdd option to editableList

This commit is contained in:
Nick O'Leary 2016-09-29 23:44:49 +01:00
parent 15e828e975
commit 84457bc7b4
1 changed files with 5 additions and 2 deletions

View File

@ -87,7 +87,10 @@
this.activeFilter = this.options.filter||null; this.activeFilter = this.options.filter||null;
this.activeSort = this.options.sort||null; this.activeSort = this.options.sort||null;
this.scrollOnAdd = this.options.scrollOnAdd;
if (this.scrollOnAdd === undefined) {
this.scrollOnAdd = true;
}
var minHeight = this.element.css("minHeight"); var minHeight = this.element.css("minHeight");
if (minHeight !== '0px') { if (minHeight !== '0px') {
this.uiContainer.css("minHeight",minHeight); this.uiContainer.css("minHeight",minHeight);
@ -255,7 +258,7 @@
} }
} }
if (!that.activeSort) { if (!that.activeSort && that.scrollOnAdd) {
setTimeout(function() { setTimeout(function() {
that.uiContainer.scrollTop(that.element.height()); that.uiContainer.scrollTop(that.element.height());
},0); },0);