Not exactly sure the best way to code the following scenario...I have Upload, ComboBox and Grid controls. The Grid has a column with a Dropdown/Select column. The data for this columns needs to be populated based upon the selected value of the ComboBox. The Grid itself is not populated until after the Upload control has performed its actions. The data (re)bound to the Grid also has the same value from the ComboBox.
I've tried two types of columns for the Grid. A Foreign Key column and a Bound column with an EditorTemplate. Both will retrieve an initial dataset of all records, but neither can I figure out how to filter or rebind based upon the new data (available after the Upload control is complete).
I'm working in MVC. I've looked at this doc http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc.UI.Fluent/GridBoundColumnBuilder#editorviewdatasystemobject but it does not allow me to pass data from the Model to the EditorTemplate as documented. I also was unable to find the documentation on how to use the EditorView object in the EditorTemplate.
ComboBox:
Upload:
Upload (Event Script):
Grid - 2nd column needs to be a dropdown bound based on one of two possible parameter: FileUploadGroupId (in Grid data model) or EngineGroupId (value of ComboBox):
EditorTemplate - Currently Binding to All EngineModels, but need to call either by EngineModel.GetByEngineGroupId(...) or GetByUploadGroupId(...):
Ideas?
I've tried two types of columns for the Grid. A Foreign Key column and a Bound column with an EditorTemplate. Both will retrieve an initial dataset of all records, but neither can I figure out how to filter or rebind based upon the new data (available after the Upload control is complete).
I'm working in MVC. I've looked at this doc http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc.UI.Fluent/GridBoundColumnBuilder#editorviewdatasystemobject but it does not allow me to pass data from the Model to the EditorTemplate as documented. I also was unable to find the documentation on how to use the EditorView object in the EditorTemplate.
ComboBox:
@(Html.Kendo().ComboBox()
.Name("engineGroupList")
.Placeholder("Select Engine Group...")
.DataTextField("EngineGroupName")
.DataValueField("EngineGroupId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEngineGroups", "Equipment")
.Data("engineGroupFilter");
});
})
.CascadeFrom("customerList")
.Events(events => events.Change("engineGroupChange"))
)
@(Html.Kendo().Upload()
.Name("dasFiles")
.Async(a => a
.Save("UploadDas", "Data")
.AutoUpload(true)
.Batch(true)
).Events(events => events.Success("dasFilesSuccess")
)
function dasFilesSuccess(e) {
var grid = $("#dasFilesGrid").data("kendoGrid");
grid.dataSource.data(e.response.Data);
}
@(Html.Kendo().Grid(Model)
.Name("dasFilesGrid")
.Columns(columns =>
{
columns.Bound(m => m.FileUploadRawFileName);
columns.Bound(m => m.FileUploadGroupId).EditorTemplateName("Engine");
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(e => e.FileUploadRawId);
})
)
)
@model List<
EngineModel
>
@(Html.Kendo().DropDownListFor(m => m)
.Name("Engine")
.DataValueField("EngineID")
.DataTextField("Model")
.BindTo((System.Collections.IEnumerable)EngineModel.All())
)