我无法获得相等过滤器(“等于”或“不等于”)来处理剑道网格中的“请求状态”列。我可以在网格中的其他列上使用它,例如Buyer。
但“包含”过滤器适用于“请求状态”列。为什么不等于工作?
示例:正确包含“已拒绝”过滤器。等于“被拒绝”不会。
HTML:
<div class="k-content">
<table id="grid" style="display:none;">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead style="font-size:80%;">
<tr>
<th>Id</th>
<th>Request Status</th>
<th>Vendor Rep</th>
<th>Buyer</th>
<th>UPC</th>
<th>Brand</th>
<th>Description</th>
<th>Create Date</th>
<th>Update Date</th>
</tr>
</thead>
<tbody>
@foreach (var itemRequest in this.Model)
{
<tr>
<td>@itemRequest.Id</td>
<td>@(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Draft ? "Draft" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.MerchandisingReview ? "Merchandising" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.SpacePlanningReview ? "Space Planning" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.DataIntegrityReview ||
itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.DataIntegrityFinalReview ? "Data Integrity" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.VendorRepReview ? "Vendor Rep" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Approved ? "Approved" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Rejected ? "Rejected" : ""
)))))))
</td>
<td>@itemRequest.GetAuthor().FirstName @itemRequest.GetAuthor().LastName</td>
<td>@(itemRequest.GetBuyer() != null ? @String.Format("{0}", itemRequest.GetBuyer().Name) : "")</td>
<td>@itemRequest.Upc</td>
<td>@itemRequest.BrandCode</td>
<td>@itemRequest.Description</td>
<td>@itemRequest.CreateDate.ToShortDateString()</td>
<td>@(itemRequest.LastUpdateDate.HasValue ? ((DateTime)itemRequest.LastUpdateDate).ToShortDateString() : "")</td>
</tr>
}
</tbody>
</table>
</div>
脚本:
<script src="~/Content/Scripts/kendo/js/kendo.web.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#grid").kendoGrid({
sortable: true,
scrollable: false,
filterable: true,
pageable: true,
dataSource: {
schema: {
model: {
id: "Id",
fields: {
Id: { type: "number" },
//2014-03-27: Issue #69
ItemRequestStatusId: { type: "string" },
VendorRep: { type: "string" },
Buyer: { type: "string" },
Upc: { type: "number" },
Brand: { type: "string" },
Description: { type: "string" },
CreateDate: { type: "date" },
UpdateDate: { type: "date" }
}
}
},
pageSize: 10
},
columns: [
{ field: "Id", template: "<a href=\"/items/itemrequest/display/#: Id #\">#: Id # </a>" },
{ field: "ItemRequestStatusId" },
{ field: "VendorRep" },
{ field: "Buyer" },
{ field: "Upc" },
{ field: "Brand" },
{ field: "Description" },
{ field: "CreateDate", format: "{0:MM/dd/yyyy}" },
{ field: "UpdateDate", format: "{0:MM/dd/yyyy}" }
]
});
$("#grid").css("display", "table");
var grid = $("#grid").data("kendoGrid");
var hide = $('#hide_Status').val()
if(hide)
{
grid.hideColumn(1);
}
var tacos = 0;
});
</script>
答案 0 :(得分:1)
无论出于何种原因,它都可以将ItemRequestStatusId分配给变量,然后在单元格中使用该变量。
更改为HTML:
@foreach (var itemRequest in this.Model)
{
string status = (itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Draft ? "Draft" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.MerchandisingReview ? "Merchandising" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.SpacePlanningReview ? "Space Planning" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.DataIntegrityReview ||
itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.DataIntegrityFinalReview ? "Data Integrity" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.VendorRepReview ? "Vendor Rep" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Approved ? "Approved" :
(itemRequest.ItemRequestStatusId == Portal.BusinessModel.Entities.ItemRequestStatusId.Rejected ? "Rejected" : ""
)))))));
<tr>
<td>@itemRequest.Id</td>
<td>@status</td>
<td>@itemRequest.GetAuthor().FirstName @itemRequest.GetAuthor().LastName</td>
<td>@(itemRequest.GetBuyer() != null ? @String.Format("{0}", itemRequest.GetBuyer().Name) : "")</td>
<td>@itemRequest.Upc</td>
<td>@itemRequest.BrandCode</td>
<td>@itemRequest.Description</td>
<td>@itemRequest.CreateDate.ToShortDateString()</td>
<td>@(itemRequest.LastUpdateDate.HasValue ? ((DateTime)itemRequest.LastUpdateDate).ToShortDateString() : "")</td>
</tr>
}