Hi Telerik Team,
I am having telerik MVC kendo grid(server side grid), In the grid I have defined databinding event. In databinding I want to call web api and alter grid's underline items based on that, and want grid to take updated items and display in grid. mainly want grid to wait for ajax complete before invoking it's databound event. plz share how to achieve that.
Please find the code snippet below,
@(Html.Kendo().Grid<Model>()
.Name("grdResults")
.Columns(columns =>
{
columns.Bound(e => e.Title).Title("Title").Width(300);
columns.Bound(e => e.resources).Encoded(false).Width(100).Title("Resource").Sortable(false);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Custom()
.Schema(sch =>
{
sch.Model(m =>
{
m.Id("field1");
m.Field(f => f.field1).Editable(false);
});
})
.Type("odata-v4")
.Transport(transport =>
{
transport.Read(read => read.Url(odataurl)
.DataType("json")
);
})
.PageSize(10)
.ServerPaging(true)
.ServerSorting(true)
//.ServerFiltering(true)
)
.Sortable()
.Pageable()
.Events(e => e.DataBinding("onDataBinding"))
)
<script>
function onDataBinding(arg) {
//Making ajax call here and and changing the arg.items value for a particular column,but value is not getting updated in the grid
Note: I am able to update the grid column value when I make async: false in ajax call
}
</script>
Thanks,
Prathibha