Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7_1_X][TIMOB-25843] Android: Fix TableView handleSetData() #9917

Merged
merged 4 commits into from Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -208,7 +208,6 @@ public void updateRow(Object row, Object data, @Kroll.argument(optional = true)
}
if (sectionProxy != null) {
sectionProxy.updateRowAt(rowIndex, rowProxy);
getTableView().setModelDirty();
updateView();
} else {
Log.e(TAG, "Unable to update row. Non-existent row: " + row);
Expand All @@ -235,7 +234,6 @@ public void updateSection(Number index, Object data, @Kroll.argument(optional =
oldSection.setParent(null);
}
}
getTableView().setModelDirty();
updateView();
} catch (IndexOutOfBoundsException e) {
Log.e(TAG, "Unable to update section. Index out of range. Non-existent section at " + index);
Expand Down Expand Up @@ -281,7 +279,6 @@ private void handleAppendRow(Object rows)
}
}

setModelDirtyIfNecessary();
updateView();
}

Expand Down Expand Up @@ -315,7 +312,6 @@ private void handleAppendSection(Object sections)
}
}

getTableView().setModelDirty();
updateView();
}

Expand Down Expand Up @@ -350,7 +346,6 @@ private void handleDeleteRow(Object row) throws IllegalStateException
RowResult rr = new RowResult();
if (locateIndex(index, rr)) {
rr.section.removeRowAt(rr.rowIndexInSection);
setModelDirtyIfNecessary();
updateView();
} else {
Log.e(TAG, "Unable to delete row. Index out of range. Non-existent row at " + index);
Expand All @@ -360,7 +355,6 @@ private void handleDeleteRow(Object row) throws IllegalStateException
TiViewProxy section = rowProxy.getParent();
if (section instanceof TableViewSectionProxy) {
((TableViewSectionProxy) section).remove(rowProxy);
setModelDirtyIfNecessary();
updateView();
} else {
Log.e(TAG, "Unable to delete row. The row is not added to the table yet.");
Expand Down Expand Up @@ -395,7 +389,6 @@ private void handleDeleteSection(int index) throws IllegalStateException
if (section.getParent() == this) {
section.setParent(null);
}
getTableView().setModelDirty();
updateView();
} catch (IndexOutOfBoundsException e) {
throw new IllegalStateException("Unable to delete section. Index out of range. Non-existent section at "
Expand Down Expand Up @@ -461,7 +454,7 @@ private void handleInsertRowBefore(int index, Object data) throws IllegalStateEx
Object[] args = { rowProxyFor(data) };
processData(args);
}
getTableView().setModelDirty();

updateView();
}

Expand Down Expand Up @@ -492,7 +485,6 @@ private void handleInsertSectionBefore(int index, Object data) throws IllegalSta
ArrayList<TableViewSectionProxy> currentSections = getSectionsArray();
currentSections.add(index, sectionProxy);
sectionProxy.setParent(this);
getTableView().setModelDirty();
updateView();
} catch (IndexOutOfBoundsException e) {
throw new IllegalStateException("Unable to insert section. Index out of range. Non-existent row at "
Expand Down Expand Up @@ -523,7 +515,6 @@ private void handleInsertRowAfter(int index, Object data) throws IllegalStateExc
// TODO check for section
TableViewRowProxy rowProxy = rowProxyFor(data);
rr.section.insertRowAt(rr.rowIndexInSection + 1, rowProxy);
setModelDirtyIfNecessary();
updateView();
} else {
throw new IllegalStateException("Index out of range. Non-existent row at " + index);
Expand Down Expand Up @@ -562,7 +553,6 @@ private void handleInsertSectionAfter(int index, Object data) throws IllegalStat
ArrayList<TableViewSectionProxy> currentSections = getSectionsArray();
currentSections.add(index + 1, sectionProxy);
sectionProxy.setParent(this);
getTableView().setModelDirty();
updateView();
} catch (IndexOutOfBoundsException e) {
throw new IllegalStateException("Unable to insert section. Index out of range. Non-existent row at "
Expand Down Expand Up @@ -719,7 +709,6 @@ private void handleSetData(Object[] data)
{
if (data != null) {
processData(data);
getTableView().setModelDirty();
updateView();
}
}
Expand Down
Expand Up @@ -67,6 +67,7 @@ public boolean onLongClick(KrollDict data)
public void setModelDirty()
{
tableView.getTableViewModel().setDirty();
getTableView().dataSetChanged();
}

public TableViewModel getModel()
Expand Down