In asp.net core I would like to refresh a grid form combobox.
Here my code but not working
<div class="k-content">
@(Html.Kendo().ComboBox()
.Name("periods")
.HtmlAttributes(new { style = "width:100%;" })
.DataTextField("Description")
.DataValueField("NoPeriod")
.Placeholder("Choisir une période")
.Filter(FilterType.Contains)
.SelectedIndex(0)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("PeriodList_Read", "TimeSheet");
});
})
.Events(e =>
{
e.Change("onAssigneeChange");
})
)
</div>
<div class="k-content">
@(Html.Kendo().Grid<ProKontrolTimeSheet.Models.TimeSheetItemVIEW>()
.Name("TimeSheetGrid")
.Reorderable(reorder => reorder.Columns(true))
.Mobile()
.Columns(columns =>
{
//columns.Select().Width(50);
columns.Bound(p => p.NoTimeSheet).HtmlAttributes(new { id = "NoTimeSheet", style = "display : none" });
columns.Bound(p => p.Journee).Width(125).HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Debut);
columns.Bound(p => p.Fin).Width(150).HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Contract).Width(150).HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Project).Width(150).HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Category).Width(150).HtmlAttributes(new { style = "text-align:center" });
columns.Bound(p => p.Emplacement).Width(150).HtmlAttributes(new { style = "text-align:center" });
})
.Scrollable(s=> s.Virtual(true))
.HtmlAttributes(new { style = "height:750px;"})
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn)
.ShowIndexes(true))
.DataSource(dataSource => dataSource
.Ajax()
.GroupPaging(false)
.PageSize(50)
.Batch(true)
.AutoSync(true)
.ServerOperation(false)
.Read(read => read.Action("TimeSheetPeriod_Read", "TimeSheet").Data("additionalInfo")
)
)
)
</div>
<script>
var NoPeriod = 0
function onAssigneeChange(e) {
NoPeriod = e.sender.value();
$("#TimeSheetGrid").dataSource.Data("additionalInfo").read();
}
function additionalInfo() {
return {
PeriodId: NoPeriod
}
}
</script>