[英]kendo grid filter works with “contains” but not equality
I can't get the equality filter ("is equal to" or "is not equal to") to work on the "Request Status" column in a kendo grid. 我无法使相等过滤器(“等于”或“不等于”)在剑道网格的“请求状态”列上工作。 I can use it on other columns in the grid, such as Buyer.
我可以在网格中的其他列(例如买方)上使用它。
But the "contains" filter works on the "Request Status" column. 但是“包含”过滤器可在“请求状态”列上使用。 Why doesn't equals work?
为什么不等于工作?
Example: Contains "Rejected" filters correctly. 示例:正确包含“已拒绝”过滤器。 Equal to "Rejected" does not.
等于“拒绝”不。
HTML: 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: 脚本:
<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>
For whatever reason, it works to assign the ItemRequestStatusId to a variable, and then use that variable in the cell. 无论出于何种原因,它都可以将ItemRequestStatusId分配给变量,然后在单元格中使用该变量。
Change to HTML: 更改为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>
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.