Skip to content

Commit

Permalink
Clone the grocery object to force a change in the UI
Browse files Browse the repository at this point in the history
Fixes #46
  • Loading branch information
tjvantoll committed Feb 23, 2016
1 parent aba01a5 commit c6e82b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/platform.android.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.link {
background-color: transparent;
border: none;
box-shadow: none;
}
5 changes: 4 additions & 1 deletion app/shared/view-models/grocery-list-view-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ function GroceryListViewModel(items) {
viewModel.toggleDone = function(index) {
var item = viewModel.getItem(index);
item.done = !item.done;
viewModel.setItem(index, item);

// Use Object.assign to clone the object to ensure NativeScript
// detects the change and updates the UI accordingly
viewModel.setItem(index, Object.assign({}, item));

return fetch(config.apiUrl + "Groceries/" + item.id, {
method: "PUT",
Expand Down

0 comments on commit c6e82b6

Please sign in to comment.