Skip to content

Commit

Permalink
fix the remove update logic so that when we remove nested input table…
Browse files Browse the repository at this point in the history
… items the table updates
  • Loading branch information
jstrachan committed Apr 2, 2013
1 parent e700062 commit 33227c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hawtio-web/src/main/webapp/app/datatable/js/datatablePlugin.ts
Expand Up @@ -196,13 +196,22 @@ module DataTable {
// TODO deal with the data name changing one day?
data = gridOptions.data;
if (data) {
scope.$watch(data, function (value) {
var listener = function (value) {
if (initialised || (value && (!angular.isArray(value) || value.length))) {
initialised = true;
destroyChildScopes();
widget.populateTable(value);
updateLater();
}
};
scope.$watch(data, listener);

// lets add a separate event so we can force updates
// if we find cases where the delta logic doesn't work
// (such as for nested hawtioinput-input-table)
scope.$on("hawtio.datatable." + data, function (args) {
var value = Core.pathGet(scope, data);
listener(value);
});
}
}
Expand Down
Expand Up @@ -170,6 +170,10 @@ module Forms {
});
}
Core.pathSet(scope, entityName, data);

// TODO for some reason this doesn't notify the underlying hawtio-datatable that the table has changed
// so lets force it with a notify...
scope.$emit("hawtio.datatable." + entityName, data);
Core.$apply(scope);
}
}
Expand Down

0 comments on commit 33227c8

Please sign in to comment.