Hi there,
I'm creating a custom datasource
01.@(Html.Kendo().Grid<Foo>()02. .Name("grid")03. .AutoBind(false)04. .DataSource(dataSource => dataSource05. .Custom()06. .Batch(true)07. .Schema(s =>08. s.Model(model =>09. {10. model.Id(p => p.ID);11. model.Field(x => x.ID).DefaultValue(0);12. })13. )14. .Transport(new15. {16. read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customRead" },17. create = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customCreate" },18. update = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customUpdate" },19. destroy = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customDestroy" },20. })21. )22.)
I need in runtime to change all the transport's handlers (in JavaScript).
I've read the documentation and some posts in the forum but I can't make it work. The last thing I tried was this
01.function anotherDestroy(e) {02. console.log("calling anotherDestroy()");03.}04. 05.let ds = 06. $("#grid")07. .data("kendoGrid")08. .dataSource;09. 10.ds.transport.options.destroy = anotherDestroy;
Can someone please tell me what I'm doing wrong?
Thank you.
