Hi,
I have a Kendo MVC Grid with start date and end date filters on the same page:
@(Html.Kendo().Grid<UnileverMetricsSystem.Entities.VisitsByTimeDTO>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.DateFormat).Width(140);
columns.Bound(c => c.Product).Width(190);
columns.Bound(c => c.Duration);
columns.AutoGenerate(false);
})
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
)
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("RefreshTable", "AverageDuration").Data("additionalInfo"))
)
)
The initial grid data is binded calling RefreshTable action.
When the user click on a "Show" button I want to filter the grid taking into account the start and end dates.
I do this through an Ajax call to a controller:
$.ajax({
type: "POST",
url: controllerName + '/RefreshTable',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify({ country: country, startDate: startDate, endDate: endDate, groupedBy: groupedBy, product: product }),
success: function (results) {
$("#grid").kendoGrid({
autoBind: false,
dataSource: results,
pageable: {
pageSize: 5,
autoBind: false,
info: true,
refresh: false
}
});
dataSource2.read();
}
});
The new data loads correctly in the grid but when i change the page I am paging the data that was initially shown in the grid, not the filtered by dates data.
How can I implement client paging with this configuration?
Thanks in advance.
I have a Kendo MVC Grid with start date and end date filters on the same page:
@(Html.Kendo().Grid<UnileverMetricsSystem.Entities.VisitsByTimeDTO>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.DateFormat).Width(140);
columns.Bound(c => c.Product).Width(190);
columns.Bound(c => c.Duration);
columns.AutoGenerate(false);
})
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
)
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("RefreshTable", "AverageDuration").Data("additionalInfo"))
)
)
The initial grid data is binded calling RefreshTable action.
When the user click on a "Show" button I want to filter the grid taking into account the start and end dates.
I do this through an Ajax call to a controller:
$.ajax({
type: "POST",
url: controllerName + '/RefreshTable',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify({ country: country, startDate: startDate, endDate: endDate, groupedBy: groupedBy, product: product }),
success: function (results) {
$("#grid").kendoGrid({
autoBind: false,
dataSource: results,
pageable: {
pageSize: 5,
autoBind: false,
info: true,
refresh: false
}
});
dataSource2.read();
}
});
The new data loads correctly in the grid but when i change the page I am paging the data that was initially shown in the grid, not the filtered by dates data.
How can I implement client paging with this configuration?
Thanks in advance.