0

我有一个名为用户帐户的表。其值如下:

[{"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}]"

我正在尝试使用 Kendo UI Grid 显示这些值。其中,仅显示最后两行。缺少用户帐户类型为“用户奖励”的第一行。

从服务器返回的值有三行。但在绑定时它只显示最后两行。

这是我的代码:

$("#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);

        }

我不知道为什么只有那一行丢失了。另外我该如何检查缺失行的错误?

4

0 回答 0