How to update multiple record in angular 5.
below code for single row update.
- editCustomTableRecord(index, record) {
- debugger;
- let filteredArray = this.CustomTables.customTableFieldList.filter(i => i.isKey == true);
- if (filteredArray.length > 0) {
- if (this.customTableRecordIds == null) {
- this.customTableRecordIds = index + ",";
- }
- else {
- this.customTableRecordIds += index + ",";
- }
- this.editCustomRecord = record;
- this.editRecord[index] = true;
- }
- else {
- swal();
- }
- }
and now below code for multiple record save:
- saveAllCustomTableRecord() {
- debugger;
- this.customTableRecordIds.forEach(customTableRecordId => {
- if (customTableRecordId != ',') {
- this.clixzService.customtablerecordService.putCustomTableRecord(this.customTableId, this.CustomTableRecords[customTableRecordId]).then(customeRecord => {
- this.responseModel.createObject(customeRecord);
- if (this.responseModel.isError == false) {
- this.editRecord[customTableRecordId] = false;
- }
- else {
- swal('Opps...', '', 'error');
- }
- });
- }
- });
- }
but does not save data. already get customTableRecordIds.