LP1849212: fix editing for course materials
authorJane Sandberg <sandbej@linnbenton.edu>
Wed, 2 Sep 2020 16:37:50 +0000 (09:37 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Mon, 7 Sep 2020 18:11:27 +0000 (11:11 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.ts

index 6881531..bb69519 100644 (file)
@@ -132,9 +132,9 @@ export class CourseAssociateMaterialComponent extends DialogComponent implements
         editOneThing(itemFields.shift());
     }
 
-    showEditDialog(course_material: IdlObject): Promise<any> {
+    showEditDialog(courseMaterial: IdlObject): Promise<any> {
         this.editDialog.mode = 'update';
-        this.editDialog.recordId = course_material._id;
+        this.editDialog.recordId = courseMaterial.id();
         return new Promise((resolve, reject) => {
             this.editDialog.open({size: 'lg'}).subscribe(
                 result => {
@@ -142,11 +142,9 @@ export class CourseAssociateMaterialComponent extends DialogComponent implements
                         .then(str => this.toast.success(str));
                     this.pcrud.retrieve('acmcm', result).subscribe(material => {
                         if (material.course() !== this.courseId) {
-                            this.materialsDataSource.data.splice(
-                                this.materialsDataSource.data.indexOf(course_material, 0), 1
-                            );
+                            this.materialsGrid.reload();
                         } else {
-                            course_material._relationship = material.relationship();
+                            courseMaterial.relationship = material.relationship();
                         }
                     });
                     resolve(result);