C# 绑定到剑道ui网格时缺少行
我有一个名为用户帐户的表。其值如下所示:C# 绑定到剑道ui网格时缺少行,c#,kendo-ui-grid,C#,Kendo Ui Grid,我有一个名为用户帐户的表。其值如下所示: [{"Amount":17.0000,"DateOfTransaction":"/Date(1422815400000+0530)/","UserAccountId":12,"UserAccountType":"UserAward","UserPoints":150}, {"Amount":3.1700,"DateOfTransaction":"/Date(1431596225417+0530)/","UserAccountId":44,"UserAc
[{"Amount":17.0000,"DateOfTransaction":"/Date(1422815400000+0530)/","UserAccountId":12,"UserAccountType":"UserAward","UserPoints":150},
{"Amount":3.1700,"DateOfTransaction":"/Date(1431596225417+0530)/","UserAccountId":44,"UserAccountType":"UserOrder","UserPoints":32},
{"Amount":15.0000,"DateOfTransaction":"/Date(1432625433707+0530)/","UserAccountId":53,"UserAccountType":"UserOrder","UserPoints":150}]"
我正在尝试使用剑道UI网格显示这些值。
其中,仅显示最后两行。缺少用户帐户类型为“用户奖励”的第一行
从服务器返回的值有三行。但在绑定时,它只显示最后两行
这是我的密码:
$("#transactions-grid").kendoGrid({
dataSource: {
transport: {
read: "/CustomerCall/GetUserTransactionsHistory/" + $('#SystemUserId').val(),
},
total: function () {
console.log(response.data);
return response.data.length;
},
schema: {
model: {
fields: {
UserAccountType: { type: "string" },
UserPoints: { type: "number" },
Amount: { type: "number", format: "{0:c2}" },
DateOfTransaction: { type: "date", format: "{0:dd-MM-yyyy}" }
}
},
errors: function (e) {
console.log(e);
}
},
pageSize: 5,
serverPaging: false,
serverFiltering: false,
serverSorting: false
},
filterable: false,
sortable: true,
pageable: true,
detailInit: detailInit,
dataBound: function () {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
scrollable: true,
columns: [{
field: "UserAccountType",
title: "Transaction Type",
lockable: false,
width: 100
}, {
field: "UserPoints",
title: "User Points",
lockable: false,
width: 80
}, {
field: "Amount",
title: "Amount",
lockable: false,
width: 80
}, {
field: "DateOfTransaction",
title: "Transaction Date",
lockable: false,
width: 80,
template: "#= kendo.toString(kendo.parseDate(DateOfTransaction, 'yyyy-MM-dd'), 'dd/MM/yyyy') #"
}, {
template: '<button class="btn btn-sm btn-white" data-useraccountid="#=UserAccountId#">Details</button>',
title: "Action",
lockable: false,
width: 55
}],
dataBound: function () {
var rows = this.items();
var index = 0;
$(rows).each(function () {
alert("success");
index = index + 1;
});
if (index > 0) {
$("#filtered-transactions").show();
}
}
});
});
My Controller is:
[HttpGet]
public PartialViewResult GetUserTransactionsSummary(int id)
{ var result = _systemUserService.GetUserTransactionHistory(new BusinessObjects.Messaging.UserAccounts.GetUserTransactionHistoryRequest(id));
var modal = _mappingService.Map<UserTransactionHistoryDto, EmployeeDetailsWithPointsVM>(result.UserTransactionHistory);
modal.JsonUserTransactionHistory = JsonHelper.JsonSerializer<List<UserAccountVM>>(modal.UserTransactionHistory);
return PartialView("GetUserTransactionsSummary", modal);
}
$(“#事务网格”).kendoGrid({
数据源:{
运输:{
阅读:“/CustomerCall/GetUserTransactionHistory/”+$(“#SystemUserId”).val(),
},
总计:功能(){
console.log(response.data);
返回响应.data.length;
},
模式:{
型号:{
字段:{
UserAccountType:{type:“string”},
用户点:{type:“number”},
金额:{type:“number”,格式:{0:c2}},
交易日期:{type:“date”,格式:{0:dd-MM-yyyy}}
}
},
错误:函数(e){
控制台日志(e);
}
},
页面大小:5,
服务器分页:false,
服务器筛选:false,
服务器排序:false
},
可过滤:false,
可排序:是的,
pageable:对,
detailInit:detailInit,
数据绑定:函数(){
this.expandRow(this.tbody.find(“tr.k-master-row”).first());
},
可滚动:对,
栏目:[{
字段:“UserAccountType”,
标题:“交易类型”,
可锁定:错误,
宽度:100
}, {
字段:“用户点”,
标题:“用户积分”,
可锁定:错误,
宽度:80
}, {
字段:“金额”,
标题:“金额”,
可锁定:错误,
宽度:80
}, {
字段:“交易日期”,
标题:“交易日期”,
可锁定:错误,
宽度:80,
模板:“#=kendo.toString(kendo.parseDate(交易日期,'yyyy-MM-dd'),'dd/MM/yyyy')#”
}, {
模板:“详细信息”,
标题:“行动”,
可锁定:错误,
宽度:55
}],
数据绑定:函数(){
var rows=this.items();
var指数=0;
$(行)。每个(函数(){
警惕(“成功”);
指数=指数+1;
});
如果(索引>0){
$(“#筛选的事务”).show();
}
}
});
});
我的控制器是:
[HttpGet]
公共PartialViewResult GetUserTransactionSummary(int id)
{var result=_systemUserService.GetUserTransactionHistory(new BusinessObjects.Messaging.UserAccounts.GetUserTransactionHistoryRequest(id));
var modal=\u mappingService.Map(result.UserTransactionHistory);
modal.JsonUserTransactionHistory=JsonHelper.JsonSerializer(modal.UserTransactionHistory);
返回PartialView(“GetUserTransactionSummary”,模态);
}
我不知道为什么那一排不见了。
还有,我应该如何检查缺少行的错误?当您调用“console.log(response.data);”时,您得到了什么?我在console.log(response.data)中什么也没有得到。同样在console.log(e)中,它显示为未定义