javascript - 如果列数据在 Bulletd 列表(数组)中,如何从 kendo Ui 网格中过滤记录
问题描述
如果列数据在 Bulletd 列表(数组)中,如何从 kendo ui 网格中过滤记录。请帮我解决这个问题。如果过滤器是内联过滤器。我的代码是这样的。
网格数据就是这样,我正在过滤提交的 ResponsibilitesNames,ResponsibilitesNames 显示在项目符号列表中。
首先我添加了网格数据,然后是 usersdatasource 网格相关代码。
CreatedBy: null
CreatedOn: "0001-01-01T00:00:00"
DBOperation: null
EmailID: "Aravind.mangavalli@sagepub.in"
IsActiveUser: false
IsUserTagged: false
IsUserTaggedSelected: false
ModifiedBy: null
ModifiedOn: "0001-01-01T00:00:00"
NoteID: 0
NotesTaggedUserID: 0
ResponsibilitesNames: " Acquiring Editor, Admin, Printing
Service, Photo Researcher, Postproduction Manager, Production
Assistant"
UserName: "Aravind Mangavalli"
VersionStamp: null
id: "3673f412-fce5-4828-b288-36ab96ed6597"
usersdataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
options.success(data);
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
pageSize: 20,
sort: { field: "UserName", dir: "asc" },
schema: {
model: {
id: "id",
fields: {
id: { from: "UserID", type: "string" },
UserName: { from: "UserName", type: "string", editable: false },
EmailID: { type: "string" },
ResponsibilitesNames: { type: "string", editable: false },
}
}
}
});
var grid = $("#UserNotesGrid").kendoGrid({
dataSource: usersdataSource,
pageable: true,
height: 430,
scrollable: true,
sortable: true,
filterable: {
extra: false,
operators: {
string: {
contains: "Contains"
}
}
},
dataBound: onDataBound,
columns: [
{ field: "id", hidden: true, title: "ID" },
{ title: "Select", template: "<input type='checkbox' class='checkbox' />", width: "25px" },
{ field: "UserName", title: "User name", width: "100px" },
{ field: "EmailID", title: "Email", width: "100px" },
{
field: "Responsibility", width: "100px",
template: function (dataItem) {
var arr = dataItem.ResponsibilitesNames.split(',');
var litemp = "<ul style='text-align: left;'>";
$.each(arr, function (index, value) {
litemp += "<li>" + value + "</li>";
});
litemp += "</ul>";
if (dataItem.ResponsibilitesNames.length > 0) {
return litemp;
}
else {
return "";
}
}
}
],
noRecords: {
template: "No users exists."
},
}).data("kendoGrid");
解决方案
推荐阅读
- angular - 输入后无法在另一个子组件上更新子组件数据
- javascript - 样条图中一个类别中的多个数据
- sql - Spark SQL中PIVOT操作的时间和空间复杂度是多少?
- couchbase - Couchbase 超时但未登录系统:completed_requests
- mysql - 如何为多个子查询赋予特定值?
- c# - 如何在依赖属性的 PropertyChangedCallback 中绑定异步方法?
- java - Java process.waitFor(time, unit) 不会超时
- google-sheets - 查询:选择并仅显示 F2 为真的 A;在 F12 为真时按 I 排序,在 F36 为真时限制 5
- angular - 为什么这个水龙头操作员不开火?
- pycharm - PyCharm 去实际实现而不是存根