|
Fetchdata.component.ts
export class FetchDataComponent {
public data: any;
public toolbarOptions: ToolbarItems[];
@ViewChild('grid')
public grid: GridComponent;
UpdateSelectedRows() { //button Click event
var grid = (document.getElementsByClassName('e-grid')[0] as any).ej2_instances[0];
var selectedRecords = grid.getSelectedRecords(); //get the selected records
var rows = JSON.stringify(selectedRecords);
var ajaxObj = new Ajax();
ajaxObj.type = 'POST';
(ajaxObj as any).contentType = 'application/json';
ajaxObj.url = '/Home/SelectRecord';
ajaxObj.data = rows;
ajaxObj.send().then(function (value) {
//you can use the below way to convert the date
var parsed = (DataUtil as any).parse.parseJson(value);
console.log(parsed);
});
}
ngOnInit(): void {
this.data = new DataManager({
url: "/Home/UrlDatasource",
adaptor: new UrlAdaptor()
});
this.toolbarOptions = ['PdfExport'];
}
} |