如何通过信号器获得kendo网格分页 [英] How do I get kendo grid paging working through signalr

查看:112
本文介绍了如何通过信号器获得kendo网格分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我这样陷入困境:



我需要用这个kendo网格控件执行服务器端分页,但我看到的每个例子都是MVC> _<< br mode =hold/>

我很确定我需要使用参数图?或者可能在我的读取方法中添加一个函数?



所以这是我的网格控件:



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

$(#notification)。kendoNotification({
宽度:100%,
位置:{
top:0,
left:0
}
});
$(#grid)。kendoGrid({
身高:550,
可编辑:false,
sortable:true,
列:[
{field:FullName},
{field:Email},
{field:FlightNumber},
{field:状态}
],
dataSource:{
类型:signalr,
autoSync:true,
//处理推送事件以在推送更新时显示通知AR rive
push:function(e){
var notification = $(#notification)。data(kendoNotification);
notification.success(e.type);
},
架构:{
总计:函数(响应){
return response.Total;
},
data:function(response){
return response.Data;
},
型号:{
id:Id,
字段:{
Id:{editable:false,type:Number},
FullName:{type:string},
FlightNumber:{type:string},
状态:{type:string}
}
}
},
// sort:[{field:FullName,dir:desc}],
serverPaging:true,
pageSize :10,
运输:{
signalr:{
promise:hubStart,
hub:hub,
server:{
read:claimIssuesRead,
update:update,
destroy:destroy,
create:create
},
client:{
read:claimIssuesRead,
更新:更新
}
}
}
},
分页:{
pageSizes:true,
refresh:true ,
buttonCount:5
}
});
});
});
< / script>





我的Hub方法:

 #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);

返回新的DataSourceResult {Data = data,Total = count};
}

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

int count;

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

返回新的AgentHubListResponse< AgentHubListPassenger>(数据,计数);

}

#endregion





我去过我使用这些集线器方法但是当我有 serverPaging时我无法触发:true



可以有人给我一个服务器分页的webforms示例吗?



谢谢^ _ ^

Andy

解决方案

(function(){
var hub =


.connection.agentServicesHub;
var hubStart =


< blockquote> .connection.hub.start()。done(function(){


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

解决方案

(function () { var hub =


.connection.agentServicesHub; var hubStart =


.connection.hub.start().done(function () {


这篇关于如何通过信号器获得kendo网格分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆