Hi
I just started the evaluation of the MVC wrappers for Kendo UI. While I am not a novice in development (including MVC) I am a bit confused how you handle things and how to achieve the basic functionality.
I need to be able to work with the grid control inside the panel that would be coming as a result of the higher level AJAX call. My current preference is the server binding - the binding that renders the grid HTML during the single round of rendering. However, our users should be able to sort by columns, filter rows - all standard functionality; and that functionality must not reload the entire browser window - only the grid.
So I created the test scenario - the Index action returns the view, which renders the basic skeleton HTML with the target DIV. After page loading I invoke AJAX call using jQuery to another action of my controller - simulating the real case scenario when views will be coming dynamically. That action returns the partial view that calls for a grid.
@model List<Telerik1.Models.Item>
@* Basic Kendo MVC Grid sortable by Age column *@
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ID).Groupable(false).Sortable(false);
columns.Bound(p => p.Name).Groupable(false).Sortable(false);
columns.Bound(p => p.Age).Groupable(false).Sortable(true);
})
.Pageable()
.Sortable(sort => sort.SortMode(GridSortMode.SingleColumn).AllowUnsort(false))
.Scrollable()
.Filterable()
.DataSource(ds => ds
.Ajax()
.Sort(s =>
{
s.Add("Age").Ascending();
})
.Read(cfg => cfg.Action("Read", "Eval1"))
)
)
I tried several things.
My initial attempt was to use .Server() for the data source. When I clicked on the "Age" column for sorting, your component redirected the entire page to its Index view (attaching grid's routing values to that address). It took me awhile to recognize why I was always getting the initial grid.
After that I switched the binding to .Ajax(). With that I pointed the .Read action to an action that returns the data source as a JSON collection but also tried to point to the action that calls for the partial view with the grid. In either case, when I try to sort or filter the result of the AJAX call is an empty grid.
I am sure I am missing something basic- some setting that would direct your component to the "Grid" action which returns the partial view with the grid specification - but I cannot pinpoint it. And I really cannot find the documentation article nor forum or blog entry, which would clearly explain the binding mechanisms, options and their implications in crystallized way.
I am attaching my sample project in hope of you spotting that missing thing. There is Eval1 controller, which I am using for evaluation.
Please note that I have removed Scripts and Content folders from the attachment to reduce the size of the attachment.
Please also note that the project was created by creating an empty MVC application and running your "Convert to Telerik application" wizard.