I would like to create certain functions that can be called by Grids (and other widgets for that matter), not in the Grid's view, but an associated Javascript file so that multiple views can use them.
I have included an example below.
If it was included in the View, then I can use 'this', but I don't believe that works in a separate JavaScript file.
Independent JavaScript File
// Draw Contract Overview Grid Chartsfunction updateGridRows(e) { // need to get calling Grid / GridName herevar gridName = ???;
var grid = $("#" + gridName).data("kendoGrid"); // update grid rows .....
}
Calling Grid View (of which there are others)
@(Html.Kendo().Grid<ContractModel>() .Name("ContractGrid")// columns .....
.DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("ReadContractGrid", "Home").Data("getDataSourceParameters")) .Update(update => update.Action("UpdateContract", "​Contracts")) .Model(model => { model.Id(contract => contract.ID); }) ) .Events(e => { e.DataBound("updateGridRows"); }))