|
gridObj.updateRowValue(10248, {OrderID:10248, CustomerID:'test111', Freight:11119}) // updateRowValue(key, {rowData}), ie key denotes PrimaryKey value of the current row. rowData denotes current row data with new values)
|
|
var searchQuery = `('` + state.search[0].key + `', ` + state.search[0].operator + `)` |
The link to the download was blocked by chrome. Any ideas?
|
import { DataManager, WebApiAdaptor, Query } from '@syncfusion/ej2-data';
import { Ajax } from '@syncfusion/ej2-base;
. ..
public flag = false;
// Grid’s actionBegin event handler
actionBegin(e) {
// Initially flag needs to be false in order to enter this condition
if (!this.flag) {
// Add and edit operations
if (e.requestType == 'save' && (e.action == 'edit' || e.action == 'add')) {
var editedData = e.data;
// The default edit operation is cancelled
e.cancel = true;
// You can send the required data to your back-end through ajax call
var ajax = new Ajax({
url: 'https://ej2services.syncfusion.com/production/web-services/',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify([editedData])
});
ajax.onSuccess = (args) => {
// Flag is enabled to skip this execution when grid ends add/edit
this.flag = true;
// The added/edited data will be saved in the Grid
this.grid.endEdit();
}
ajax.onFailure = (args) => {
// Add/edit failed
// The flag is disabled if operation is failed so that it can enter the condition on next execution
this.flag = false;
}
ajax.send();
}
if (e.requestType == 'delete') {
var editedData = e.data;
// The delete operation is cancelled
e.cancel = true;
var ajax = new Ajax({
url: 'https://ej2services.syncfusion.com/production/web-services/',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify([editedData[0][gobj.getPrimaryKeyFieldNames()[0]]])
})
ajax.onSuccess = (args) => {
// Flag is enabled to skip this execution when grid deletes record
this.flag = true;
// The deleted data will be removed in the Grid
this.grid.deleteRecord();
}
ajax.onFailure = (args) => {
// Delete failed
// The flag is disabled if operation is failed so that it can enter the condition on next execution
this.flag = false;
}
ajax.send();
}
}
}
// Grid’s actionComplete event handler
actionComplete(e) {
if (e.requestType === 'save' || e.requestType === 'delete') {
// The flag is disabled after operation is performed so that it can enter the condition on next execution
this.flag = false;
}
} |