Rajesh Gami

Rajesh Gami

  • 74
  • 24.3k
  • 1.2m

How to update multiple record in angular 5

Dec 6 2018 6:36 AM
How to update multiple record in angular 5. 
 
 
below code for single row update. 
  1. editCustomTableRecord(index, record) {  
  2.     debugger;  
  3.     let filteredArray = this.CustomTables.customTableFieldList.filter(i => i.isKey == true);  
  4.     if (filteredArray.length > 0) {  
  5.       if (this.customTableRecordIds == null) {  
  6.         this.customTableRecordIds = index + ",";  
  7.       }  
  8.       else {  
  9.         this.customTableRecordIds += index + ",";  
  10.       }  
  11.       this.editCustomRecord = record;  
  12.       this.editRecord[index] = true;  
  13.     }  
  14.     else {  
  15.       swal();  
  16.     }  
  17.   }  
 and now below code for multiple record save:
  1. saveAllCustomTableRecord() {  
  2.     debugger;  
  3.     this.customTableRecordIds.forEach(customTableRecordId => {  
  4.       if (customTableRecordId != ',') {  
  5.         this.clixzService.customtablerecordService.putCustomTableRecord(this.customTableId, this.CustomTableRecords[customTableRecordId]).then(customeRecord => {  
  6.           this.responseModel.createObject(customeRecord);  
  7.           if (this.responseModel.isError == false) {  
  8.             this.editRecord[customTableRecordId] = false;  
  9.           }  
  10.           else {  
  11.             swal('Opps...''''error');  
  12.           }  
  13.         });  
  14.       }  
  15.     });  
  16.   }  
 
but does not save data. already get  customTableRecordIds. 

Answers (1)