我有一个网格。 filtring在某些情况下像子公司一样工作,但在几乎所有其他公司中都不起作用。 这是一个代码:
<!DOCTYPE html>
<html>
<head>
<base href="http://demos.telerik.com/kendo-ui/grid/angular">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.2.805/styles/kendo.common.min.css" />
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.2.805/styles/kendo.default.min.css" />
<script src="//kendo.cdn.telerik.com/2015.2.805/js/jquery.min.js"></script>
<script src="//kendo.cdn.telerik.com/2015.2.805/js/angular.min.js"></script>
<script src="//kendo.cdn.telerik.com/2015.2.805/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example" ng-app="KendoDemos">
<div ng-controller="MyCtrl">
<div kendo-grid="grid2" k-options="gridOptions" k-rebind="gridOptions" id="grid" k-on-change="handleChange(data, dataItem, columns)" k-selectable="true">
</div>
</div>
</div>
<script>
var subscriberslistItems=[{"monthlyDBID":1603,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Prima","subCompanyDBID":10,"subCompanyID":"","subCompanyName":"Company1","firstName":"John","lastName":"Meffey","badge":38220010,"curLocation":"52","curLocationDescription":"Out","idNum":"19294","jobTitleID":4,"jobTitleDescription":"Developer","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Desc1","accessProfileID":1,"accessProfileDescription":"Profile 1","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"6523562","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"09-7990151","city":"","area":"","zipCode":"","mobile":"050-4224606","fax":"","email":"ayaa10@gmail.com","parkingSpot":"","validFromDate":366854400,"validToDate":505008000,"recordIndex":1},{"monthlyDBID":1622,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 2","subCompanyDBID":10,"subCompanyID":"","subCompanyName":"Child Company 2","firstName":"Tim","lastName":"Tompson","badge":38220000,"curLocation":"52","curLocationDescription":"Out","idNum":"19180","jobTitleID":4,"jobTitleDescription":"Driver","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Category 3","accessProfileID":1,"accessProfileDescription":"Profile 2","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"8044472","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"03-5666555","city":"","area":"","zipCode":"","mobile":"052-3233373","fax":"","email":"","parkingSpot":"","validFromDate":368064000,"validToDate":505008000,"recordIndex":2},{"monthlyDBID":1604,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 3","subCompanyDBID":10,"subCompanyID":"","subCompanyName":"Child 1","firstName":"Tim","lastName":"Tompson","badge":38220029,"curLocation":"52","curLocationDescription":"Out","idNum":"8177","jobTitleID":4,"jobTitleDescription":"Driver","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Category 7","accessProfileID":1,"accessProfileDescription":"Profile 5","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"5219217","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"","city":"","area":"","zipCode":"","mobile":"050-6996801","fax":"","email":"nave@polfin-ins.co.il","parkingSpot":"","validFromDate":366854400,"validToDate":505008000,"recordIndex":3},{"monthlyDBID":1605,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 7","subCompanyDBID":10,"subCompanyID":"","subCompanyName":"Child 7","firstName":"Hanna","lastName":"Lim","badge":38210651,"curLocation":"52","curLocationDescription":"Out","idNum":"19597","jobTitleID":4,"jobTitleDescription":"Software Developer","groupID":13,"groupDescription":"group 5","categoryID":4,"categoryDescription":"category 1","accessProfileID":4,"accessProfileDescription":"Profile 3","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"8959159","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"03-5168855","city":"","area":"","zipCode":"","mobile":"054-3001178","fax":"","email":"hana@orel","parkingSpot":"","validFromDate":366854400,"validToDate":505008000,"recordIndex":4},{"monthlyDBID":1606,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 10","subCompanyDBID":12,"subCompanyID":"","subCompanyName":"Child 1-2","firstName":"Martinי","lastName":"Shepard","badge":38220034,"curLocation":"52","curLocationDescription":"Out","idNum":"2197","jobTitleID":4,"jobTitleDescription":"Developer","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Category 7","accessProfileID":1,"accessProfileDescription":"Profile 5","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"6260067","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"03-6257147","city":"","area":"","zipCode":"","mobile":"050-6828838","fax":"","email":"tzahim@charisma-ins.co.il","parkingSpot":"","validFromDate":367113600,"validToDate":505008000,"recordIndex":5},{"monthlyDBID":1607,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 8","subCompanyDBID":12,"subCompanyID":"","subCompanyName":"Child 4","firstName":"Netanel","lastName":"Black","badge":38220032,"curLocation":"52","curLocationDescription":"Out","idNum":"72481","jobTitleID":4,"jobTitleDescription":"Driver","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Category 7","accessProfileID":1,"accessProfileDescription":"Profile 5","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"1471214","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"098840010","city":"","area":"","zipCode":"","mobile":"052-5262333","fax":"","email":"rafizakar@walla.co.il","parkingSpot":"","validFromDate":367113600,"validToDate":505008000,"recordIndex":6},{"monthlyDBID":1608,"monthlyID":"","parkDBID":2,"companyDBID":34,"companyID":"","companyName":"Company 4","subCompanyDBID":10,"subCompanyID":"","subCompanyName":"Child 4","firstName":"Mishael","lastName":"Akerman","badge":38220037,"curLocation":"52","curLocationDescription":"Out","idNum":"313043","jobTitleID":4,"jobTitleDescription":"Driver","groupID":0,"groupDescription":"","categoryID":4,"categoryDescription":"Category 6","accessProfileID":1,"accessProfileDescription":"Profile 4","monthlyType":2,"monthlyTypeDescription":"Standard","priceTableID":0,"carPlate1":"7140229","carPlate2":"","carPlate3":"","carPlate4":"","carPlate5":"","address":"","phone":"09-9514169","city":"","area":"","zipCode":"","mobile":"050-5281348","fax":"","email":"amichel@bezeqint.net","parkingSpot":"","validFromDate":367113600,"validToDate":505008000,"recordIndex":7}];
angular.module("KendoDemos", [ "kendo.directives" ])
.controller("MyCtrl", function($scope){
gridScript = {
/* read: companieslistItems,*/
dataSource: {
data: subscriberslistItems,
pageSize: 10
},
columns: [
{field: "manageName", title: "Name"},
{field: "manageNumber", title: "Number", width: "78px"},
{field: "manageCategoryDescription", title: "Desc",width:"180px"},
{field: "manageProfileAccess", title: "Access", width: "107px"},
{field: "manageParkingSpot", title: "parkingSpot", width: "107px"},
{field: "companyName", title: "CompanyName",width: "107px"},
{field: "subCompanyName", title: "subCompany",width: "107px"},
{field: "curLocationDescription", title: "curLocation", width: "78px"},
{field: "jobTitleDescription", title: "jobTitle", width: "107px"},
{field: "groupDescription", title: "group", width: "107px"},
{field: "idNum", title: "idNum", width: "107px"},
{field: "manageAddress", title: "manageAddress", width: "107px"},
{field: "manageCity", title: "City", width: "107px"},
{field: "manageArea", title: "Area", width: "107px"},
{field: "manageTelephone", title: "Phone", width: "107px"},
{field: "manageCell", title: "cell", width: "107px"},
{field: "manageEmail", title: "Email", width: "147px"}
],
rowTemplate: "<tr data-uid='#: uid #' class='hasContextMenu' role='row' data-companyName='#: companyName#'>" +
"<td colspan='1' style='text-align: center;' class='statusTemplate'> {{dataItem.firstName}} - {{dataItem.lastName}}</td>" +
"<td colspan='1' style='text-align: center;' class='valDiscount'>{{dataItem.badge}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.categoryDescription}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.accessProfileDescription}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.parkingSpot}}</td>" +
"<td colspan='1' style='text-align: center;' class='valCompany'>#: companyName#</td>" +
"<td colspan='1' style='text-align: center;' class='valSubCompany'>{{dataItem.subCompanyName}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.curLocationDescription}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.jobTitleDescription}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.groupDescription}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.idNum}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.address}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.city}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.area}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.phone}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.mobile}}</td>" +
"<td colspan='1' style='text-align: center;' >{{dataItem.email}}</td>" +
"</tr>",
filterable: true
};
$scope.gridOptions = gridScript;
})
</script>
</body>
</html>
问题在于没有错误。我看到它根本就没有过滤。 谢谢你的帮助!
答案 0 :(得分:0)
问题是在json字段中,像“badge”一样是数字,而kendo ui看到的是数字,但我没有写这个模式:
schema: {
model: {
fields: {
badge: { type: "number" }
}
}
}
所以,因为这个剑道ui无法做过滤