<ejs-grid id="GridNewKeywords" allowPaging="true" load="onLoad" actionFailure="actionFailure"
toolbar="@( new List<object>() {" Add","Edit","Delete","Update","Cancel"})">// you need to write like “Add” |
<ejs-grid id="Grid" allowPaging="true" load="onLoad" actionBegin="begin" allowFiltering="true" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel","Search" })">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-data-manager url="/Index?handler=DataSource" insertUrl="/Index?handler=Insert" updateUrl="/Index?handler=Update" removeUrl="/Index?handler=Delete" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-columns>
...
</e-grid-columns>
</ejs-grid>
<script>
function onLoad() {
this.dataSource.dataSource.headers = [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }];
}
function begin(args) {
var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0]
console.log(args);
if (args.requestType == 'delete') {
grid.dataSource.dataSource.headers = [];
grid.dataSource.dataSource.headers.push({ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val(), "KeywordId": args.data[0].EmployeeID, "UserId": args.data[0].Freight });
}
}
</script>
|