Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am getting so bogged down with this one:

I need to perform server side paging with this kendo grid control but every example i've see is MVC >_<<br mode="hold" />
I'm pretty sure I need to use the parameter map? or maybe add a function to my read method?

So here is my grid control:

<div id="grid" style="margin-bottom: 20px"></div>
<span id="notification"></span>
<script>
    $(function () {
        var hub = $.connection.agentServicesHub;
        var hubStart = $.connection.hub.start().done(function () {

            $("#notification").kendoNotification({
                width: "100%",
                position: {
                    top: 0,
                    left: 0
                }
            });
            $("#grid").kendoGrid({
                height: 550,
                editable: false,
                sortable: true,
                columns: [
                    { field: "FullName" },
                    { field: "Email" },
                    { field: "FlightNumber" },
                    { field: "Status" }
                ],
                dataSource: {
                    type: "signalr",
                    autoSync: true,
                    // Handle the push event to display notifications when push updates arrive
                    push: function(e) {
                        var notification = $("#notification").data("kendoNotification");
                        notification.success(e.type);
                    },
                    schema: {
                        total: function(response) {
                            return response.Total;
                        },
                        data: function(response) {
                            return response.Data;
                        },
                        model: {
                            id: "Id",
                            fields: {
                                "Id": { editable: false, type: "Number" },
                                "FullName": { type: "string" },
                                "FlightNumber": { type: "string" },
                                "Status": { type: "string" }
                            }
                        }
                    },
                    //sort: [{ field: "FullName", dir: "desc" }],
                    serverPaging: true,
                    pageSize: 10,
                    transport: {
                        signalr: {
                            promise: hubStart,
                            hub: hub,
                            server: {
                                read: "claimIssuesRead",
                                update: "update",
                                destroy: "destroy",
                                create: "create"
                            },
                            client: {
                                read: "claimIssuesRead",
                                update: "update"
                            }
                        }
                    }
                },
                pageable: {
                    pageSizes: true,
                    refresh: true,
                    buttonCount: 5
                }
            });
        });
    });
</script>


My Hub method/s:
#region Kendo Grid

public DataSourceResult ClaimIssuesRead(DataSourceRequest request)
{
    AgentHubListPassengerFilter filter = new AgentHubListPassengerFilter
    {
        Status = (int)PassengerClaimStatusEnum.Unpaid_NoPaymentDetails,
        PageSize = request.Take,
        PageIndex = request.Skip / request.Take
    };

    int count;

    var data = AgentHubListPassenger.Search(filter, out count);

    return new DataSourceResult { Data = data, Total = count };
}

public AgentHubListResponse<AgentHubListPassenger> ClaimIssuesRead()
{
    AgentHubListPassengerFilter filter = new AgentHubListPassengerFilter
    {
        Status = (int)PassengerClaimStatusEnum.Unpaid_NoPaymentDetails,
        //PageSize = take ?? 0,
        //PageIndex = take == null ? 0 : (skip ?? 0 / take ?? 0)
    };

    int count;

    var data = AgentHubListPassenger.Search(filter, out count);

    return new AgentHubListResponse<AgentHubListPassenger>(data, count);

}

#endregion


I've been playing with these hub methods but I can't get any to fire when I have serverPaging:true

Can anyone give me a webforms example of server pagination?

Thanks ^_^
Andy
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900