diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index 93d0d7a7..90c37b1f 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -595,25 +595,22 @@ export default class acclist extends React.Component{ } - onNameChange(e,row){ - let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id}) + onNameChange(e,row,rowIndex){ this.state.tempdata[rowIndex].product_name =e.target.value; this.setState({tempdata:this.state.tempdata}) } - onQuantityChange(e,row){ - let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id}) + onQuantityChange(e,row,rowIndex){ this.state.tempdata[rowIndex].quantity =e.target.value; this.setState({tempdata:this.state.tempdata}) } - onPriceChange(e,row){ + onPriceChange(e,row,rowIndex){ let str = e.target.value; let value= str.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.') - let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id}) this.state.tempdata[rowIndex].contract_price = value; this.setState({tempdata:this.state.tempdata}) @@ -1014,18 +1011,18 @@ export default class acclist extends React.Component{ }} - ComponentHandler={(com,rowData)=>{ + ComponentHandler={(com,rowData,rowIndex)=>{ if(com=="product_name") { - return {this.onNameChange(e,rowData)}} /> + return {this.onNameChange(e,rowData,rowIndex)}} /> } if(com=="quantity") { - return {this.onQuantityChange(e,rowData)}} /> + return {this.onQuantityChange(e,rowData,rowIndex)}} /> } if(com =="contract_price" ) { - return {this.onPriceChange(e,rowData)}} /> + return {this.onPriceChange(e,rowData,rowIndex)}} /> } if(com == "show_url")