我正在尝试一起显示属于同一笔交易的所有产品及其数量。
这是我的代码,但是它在网格中位于同一交易/订单ID的不同行中显示了两个不同的项目。
查看代码
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
schema: {
model: {
fields: {
PurchaseAmount: {
type: "number"
},
Rewards: {
type: "number"
},
Date: {
type: "date"
}
}
}
},
transport: {
read: {
url: "@Url.Action("
GetRewardList ", "
MyAccount ")",
dataType: "json"
}
},
//pageSize: 10
},
detailTemplate: "<div class='bd-callout bd-callout-warning'><div class='alert alert-success p-2 my-2'><i class='fa fa-database pl-2 pr-2' aria-hidden='true'></i> Redemption Order: #: transID #</div><div>Item: #: Product # </div><div>Item Description: #: OfferDesc #</div><div>Quantity: #:Quantity #</div></div>",
//height: 800,
//groupable: true,
sortable: true,
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
columns: [{
field: "Date",
title: "Date",
format: "{0:dddd, MMMM dd, yyyy}",
filterable: false,
},
{
field: "Rewards",
title: "Points",
filterable: false,
},
]
});
});
我的JSON
[{
"mUserID": 2024,
"transID": "091492-1002024-2601",
"Date": "2020-01-26T01:24:52.4904479",
"TransactionType": "Rewards Credit",
"Rewards": 9.0,
"Source": "Online Feed",
"Product": "Pullover Hoodie",
"PurchaseAmount": 0.0,
"OfferDesc": "",
"Quantity": 1.0,
"Status": "Approved",
"TransactionTypeID": 118
}, {
"mUserID": 2024,
"transID": "099521-1002024-2601",
"Date": "2020-01-26T03:38:41.7634102",
"TransactionType": "Rewards Credit",
"Rewards": 12.0,
"Source": "Online Feed",
"Product": "Precision Jacket",
"PurchaseAmount": 0.0,
"OfferDesc": "",
"Quantity": 2.0,
"Status": "Approved",
"TransactionTypeID": 118
}, {
"mUserID": 2024,
"transID": "099521-1002024-2601",
"Date": "2020-01-26T03:38:41.7725205",
"TransactionType": "Rewards Credit",
"Rewards": 11.0,
"Source": "Online Feed",
"Product": "Pinewood Jacket",
"PurchaseAmount": 0.0,
"OfferDesc": "",
"Quantity": 2.0,
"Status": "Approved",
"TransactionTypeID": 118
}]
如何将属于相似交易/订单ID的项目分组到我的网格中