首页 > 解决方案 > 如果列数据在 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");

标签: javascriptjqueryasp.net-corekendo-uikendo-grid

解决方案


推荐阅读