We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Refreshing a single cell in Inline editing grid

Hi Team

Is there any way that I can change a cell value in Inline editing of grid and it updates other cell without refreshing it?

1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 30, 2019 10:08 AM UTC

Hi Jatin,  
 
Thanks for contacting Syncfusion support  
 
Query1: Is there any way that I can change a cell value in Inline editing of grid and it updates other cell without refreshing it? 
 
From your query we understand that you need to update the value of one column while changing the another column in inline editing. We suggest you achieve your requirement using ValueAccessor property of ejs grid. Using ValueAccessor column we can display the values based on other columns. So while editing also once the records are saved, value will be updated based on changed value. 
 
Refer the below code example 
 
   <button ejs-button (click)='handleClick($event)'>Clear Data</button> 
    <ejs-grid [dataSource]='data' (cellSave)="onsave($event)" [editSettings]='editSettings' [toolbar]='toolbar' [height]='150'> 
                <e-columns> 
                    <e-column field='OrderID' headerText='ID' isPrimaryKey='true' width=150></e-column> 
                    <e-column field='FoodName' headerText='Food Name' width=150></e-column> 
                    <e-column field='Protein' headerText='Protein' textAlign='Right' width=120></e-column> 
                    <e-column field='Fat' headerText='Fat' textAlign='Right' width=80></e-column> 
                    <e-column field='Carbohydrate' headerText='Carbohydrate' textAlign='Right' width=120></e-column> 
                    <e-column headerText='Calories Intake' textAlign='Right' [valueAccessor]='totalCalories' width=150></e-column> 
                </e-columns> 
            </ejs-grid> 
……………………………………. 
 
  public totalCalories = (field: string, data: { Protein: number, Fat: number, Carbohydrate: number }, column: Object): number => { 
        return data.Protein * 4 + data.Fat * 9 + data.Carbohydrate * 4; 
    } 
 
 
Note: while editing, value of the CaloriesIntake column will updated based on modified values.  
 
For your convenience we have prepared a sample which can be referred below  
 
 
Refer our UG documentation for your reference 
 
 
Regards, 
Pavithra S. 


Loader.
Up arrow icon