diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewProxy.java index 0585e120475..46b80637222 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewProxy.java @@ -128,6 +128,11 @@ static public TableViewSectionProxy processSection(Object obj) */ @Kroll.method public void appendRow(Object rows, @Kroll.argument(optional = true) KrollDict animation) + { + appendRowInternal(rows, animation, false); + } + + private void appendRowInternal(Object rows, KrollDict animation, boolean internalUpdate) { final List rowList = new ArrayList<>(); @@ -190,7 +195,11 @@ public void appendRow(Object rows, @Kroll.argument(optional = true) KrollDict an // Allow updating rows after iteration. shouldUpdate = true; - update(); + + // don't update when coming from setData loop + if (!internalUpdate) { + update(); + } } /** @@ -508,7 +517,7 @@ public void setData(Object[] data) final TableViewRowProxy row = (TableViewRowProxy) d; // Handle TableViewRow. - appendRow(row, null); + appendRowInternal(row, null, true); } else if (d instanceof Object[]) { setData((Object[]) d); @@ -519,7 +528,7 @@ public void setData(Object[] data) // Handle TableViewRow dictionary. row.handleCreationDict(new KrollDict((HashMap) d)); - appendRow(row, null); + appendRowInternal(row, null, true); } else if (d instanceof TableViewSectionProxy) { final TableViewSectionProxy section = (TableViewSectionProxy) d; @@ -531,7 +540,6 @@ public void setData(Object[] data) // Allow updating rows after iteration. shouldUpdate = true; - update(); }