I have an Ajax Kendo grid and would like to apply a filter on load. There is a date column that I would like to get the max date and use that as the initial filter (not hardcoding the value). Is this doable and if so how?
Thanks
D
1 Answer, 1 is accepted
0
Accepted
Mihaela
Telerik team
answered on 21 Jul 2023, 03:30 PM
Hello,
Since you have submitted the same query as a support ticket, and I have already answered your question in the support thread, I will post the same here in case someone else has the same question:
The easiest approach will be to get the latest date on the server, store it in ViewData in the Action method that returns the View with the Grid, and pass it in the Filter configuration. For example:
Action method that returns the Grid View:
public IActionResult Index()
{
//access the Grid data from the sort the data to get the latest dateViewData["maxDate"] = new DateTime(2022, 1, 15); //store the date in ViewDatareturn View();
}
Stay tuned by visiting our public roadmap and feedback portalpages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.