From 5f047633c33c49391209a40c0e67715dc31b5295 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 28 Jun 2016 10:56:03 +0100 Subject: [PATCH] Scroll to bottom when item added to editableList --- editor/js/ui/editableList.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editor/js/ui/editableList.js b/editor/js/ui/editableList.js index f6243f5be..921721610 100644 --- a/editor/js/ui/editableList.js +++ b/editor/js/ui/editableList.js @@ -82,6 +82,14 @@ this.uiHeight = this.options.height; } } + this.element.height('auto'); + + var attrStyle = this.element.attr('style'); + var m; + if ((m = /width\s*:\s*(\d+%)/i.exec(attrStyle)) !== null) { + this.element.width('100%'); + this.uiContainer.width(m[1]); + } if (this.options.sortable) { var handle = (typeof this.options.sortable === 'string')? this.options.sortable : @@ -169,6 +177,9 @@ var index = that.element.children().length-1; setTimeout(function() { that.options.addItem(row,index,data); + setTimeout(function() { + that.uiContainer.scrollTop(that.element.height()); + },0); },0); } },