Get current value

yo bro,

How to get the "Current value" while inline editing in grid.



1 Reply

HJ Hariharan J V Syncfusion Team August 2, 2018 11:28 AM UTC

Hi Neo, 
 
Thanks for contacting Syncfusion support. 
 
Query: How to get the "Current value" while inline editing in grid. 
 
We have validated your query and you can achieve your requirement by using the below method. Here, we have achieved your requirement by using button click event. In the below code example, we have to get currently edited cell value of CustomerID column. Please find the below code example for your reference. 
 
[Code example] 
  @Component({ 
    selector: 'my-app', 
    template: `<button id='button' ej-button class='e-flat' (click)='getEditCellValue()'> Get edit cell value </button> 
    <ejs-grid #grid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar' [allowPaging]=true> 
    <e-columns> 
        ... 
        ...         
    </e-columns> 
</ejs-grid>`, 
    providers: [EditService, ToolbarService] 
}) 
export class AppComponent implements OnInit { 
 
    ... 
    ... 
 
    getEditCellValue(): void { 
       let targCusEle: any = this.grid.element.querySelector('#' + this.grid.element.id + 'CustomerID'); //for CustomerID column 
       let cusVal = targCusEle.value;         // get edited cell value 
       alert(cusVal); 
 
    //    let tarShipEle : any = this.grid.element.querySelector('#' + this.grid.element.id + 'ShipCountry'); 
    //    let ShipCountryVal = tarShipEle.ej2_instances[0].value;  //use this for getting cell value for other component like dropdown edit 
    //    alert(ShipCountryVal); 
    } 
} 
 
We have created a simple sample based on your requirement. Please find the sample in below link. 
 

To run the sample, use below commands. 
  1. npm install.
  2. npm start.

Please get back to us if you need further assistance on this. 

Regards, 
Hariharan 


Loader.
Up arrow icon