This is a migrated thread and some comments may be shown as answers.

Server side paging and sorting functionality

5 Answers 758 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hash
Top achievements
Rank 1
hash asked on 14 Feb 2013, 03:21 PM
I am trying to achieve serverside paging and sorting with Kendo grid. 

I have done the following which is working fine, but this is completely in the JavaScript,

("#appointmentsGrid").kendoGrid({
        columns: [
                    { field: "MemberFirstName", title: "Member<br/>First Name" },
                    { field: "MemberLastName", title: "Member<br/>Last Name" }                   
                 ],
        dataSource: new kendo.data.DataSource({
        serverPaging: true,
        serverSorting: true,
        transport: {
            read: {
                url: "/AppointmentScheduling/GetScheduledAppointments",
                data: additionalData
            }

        },
        pageSize: 10,
        schema: { data: "data", total: "total" }
        }),
        pageable: true,
        sortable : true
    });   

 Can anyone has any idea how to achieve the same functionality through razor View, if so can you please give the controller sample code too.

Since it is in javaScript, there is no intellisense and hard to find out all the options that i can give it for a column. 

5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 18 Feb 2013, 07:27 AM
Hi,

You can find an example implementation of server operations and ASP.NET MVC in this code library.

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
hash
Top achievements
Rank 1
answered on 18 Feb 2013, 03:20 PM
Hi Rosen, 

Thanks for the reply, But the code that you referred me is implementing the KEndo grid in the Javascript style.

But, i am looking for Razor extensions style. (something like this)

 @(Html.Kendo().Grid<AppointmentsDTO>().Name("ScheduledAppointments")
                .Columns(columns =>
                    {
                        columns.Bound(o => o.MemberFirstName).Title("Member<br/>First Name");
                    columns.Bound(o => o.MemberLastName).Title("Member<br/> Last Name");
                    columns.Bound(o => o.ClientMemberID).Title("Health Plan ID");
                    columns.Bound(o => o.ProviderID).Title("Provider ID");
                    columns.Bound(o => o.ProviderFirstName).Title("Practitioner<br/> First Name");
                    columns.Bound(o => o.ProviderLastName).Title("Practitioner<br/> Last Name");
                    columns.Bound(o => o.AppointmentDateDisplay).Title("Appointment<br/> Date / Time").Width(125);
                    columns.Bound(o => o.IHAAppointmentID).Hidden(true);
                })
                .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read =>
                    {
                        read.Action("GetScheduledAppointments", "AppointmentScheduling");
                        read.Data("additionalData");
                    }))
                .Events(e => e.DataBound("onDataBound"))
                .Pageable(page => page.Enabled(true).PageSizes(new[] { 20, 30, 50, 100 }))
                .Sortable()
                .Scrollable(scroll => scroll.Height(225))
                .AutoBind(false)
                )
0
Rosen
Telerik team
answered on 18 Feb 2013, 03:40 PM
Hi,

Information on how to setup the KendoUI for ASP.NET MVC Grid widget for AJAX binding can be found here. Details about custom binding configuration, in case you want to handle the data processing manually, can be found here.

Also you may find helpful the sample application available within the KendoUI for ASP.NET MVC distribution.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
hash
Top achievements
Rank 1
answered on 18 Feb 2013, 03:50 PM
Hi Rosen, 

Thanks for the quick reply. I actually referenced the same document when i am trying to achieve this functionality, but the problem i am currently facing is , in the request object the sorts is always coming as null, I examined the request with Developer tools I can see the sorts coming as request parameter. 

Any idea, why the sorts is always null in the Datasourcerequest object. 

I am sure the if i send the code, that will help you, but my app is 3 layered app and i definitely can not send the code sample :(. I looked at multiple forum posts on the same issue and i came to know its not just me, but none of them posted a clear answer. 

Any help is appreciated. 
0
Rosen
Telerik team
answered on 18 Feb 2013, 04:13 PM
Hello,

You should verify that you have correctly configured your project. Make sure the kendo.aspnetmvc.min.js file is included and script files are in the correct order.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
hash
Top achievements
Rank 1
Answers by
Rosen
Telerik team
hash
Top achievements
Rank 1
Share this question
or