Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (30 sloc) 1.15 KB
diff --git a/web/assets/js/RepLogApp.js b/web/assets/js/RepLogApp.js
index 9369f4b..8423060 100644
--- a/web/assets/js/RepLogApp.js
+++ b/web/assets/js/RepLogApp.js
@@ -86,7 +86,15 @@
method: 'DELETE'
}).then(() => {
$row.fadeOut('normal', () => {
+ // we need to remove the repLog from this.repLogs
+ // the "key" is the index to this repLog on this.repLogs
+ this.repLogs.splice(
+ $row.data('key'),
+ 1
+ );
+
$row.remove();
+
this.updateTotalWeightLifted();
});
})
@@ -177,7 +185,10 @@
// console.log(id, itemLabel, reps, totallyMadeUpKey);
const html = rowTemplate(repLog);
- this.$wrapper.find('tbody').append($.parseHTML(html));
+ const $row = $($.parseHTML(html));
+ // store the repLogs index
+ $row.data('key', this.repLogs.length - 1);
+ this.$wrapper.find('tbody').append($row);
this.updateTotalWeightLifted();
}
You can’t perform that action at this time.