In angular 12 I am performing update on table value, if I update value for first time its working but if I try to update it again its not working

Viewed 19

Here In a thresholdData holds all the result in newArray object I am pushing my updated records. data and index I am passing from html on blur event.

getValue(data,index){
        if(this.newArray.length >0 && this.thresholdData[index].THRESHOLD_LIMIT != data.threshold_org){
          console.log(data.THRESHOLD_LIMIT,data.threshold_org)
          this.thresholdData[index].THRESHOLD_LIMIT = data.threshold_org;
          for(let i=0;i<this.newArray.length;i++){
            if(this.newArray[i].sapCode == data.MEMBER_SAP_CODE){
              this.newArray[i].thresholdValue = this.thresholdData[index].THRESHOLD_LIMIT;
            }
            else{
              let newObj = 
              {"sapCode":data.MEMBER_SAP_CODE,"dealerName":data.MEMBER_NAME,
              "thresholdValue":data.threshold_org}
                this.newArray.push(newObj);   
            }
          }
      }
      else if (this.thresholdData[index].THRESHOLD_LIMIT != data.threshold_org && this.newArray.length == 0){
        let newObj = 
        {"sapCode":data.MEMBER_SAP_CODE,"dealerName":data.MEMBER_NAME,"thresholdValue":data.threshold_org}
          this.newArray.push(newObj);   
        }
       console.log(this.newArray,"new array");
      }
      
0 Answers
Related