Creating a unique filter function for a Kendo Grid that includes a multi-select column

I am facing a challenge with writing a custom filter function for a kendo grid that has multiple columns such as name, age, and city. Specifically, I need the name column to have a multiselect filter with "or" logic while the rest of the grid follows an "and" logic.

In my search for a solution, I came across a helpful post by Telerik which suggests removing the data-bind attribute using:

element.removeAttr("data-bind");

Although this method works well, it fails to clear all tags from the multiselect field when in filterMode: "row". This led me to start working on a custom filter function. Here is a snippet of my progress so far:

filterable: {
    multi: true,
    cell: {
        template: function getteamplate(args) {
            args.element.kendoMultiSelect({
                // implementation logic
            });

            //args.element.removeAttr("data-bind");
        },

        showOperators: false
    }
}

However, I have encountered a couple of challenges:

  1. My custom filter function is not executing as expected, and I do not see any output in the console.
  2. Referring to this forum post, the code for the operator function seems straightforward:

    operator: function(item, value){ //implement your logic }

Despite the simplicity of the code, I am unsure about the parameters 'item' and 'value' and their origin.

Answer №1

It's a bit belated, but no worries. To ensure that the tags are cleared correctly, I implemented the following steps:

  1. Assigned an id property to the dom element of the multiselect object like so:

 function getteamplate(args) {
    args.element[0].id = "<<filterElementID>>";
    args.element.kendoMultiSelect({
                dataSource: args.dataSource,
                .............

  1. Added a condition in the grid's dataSource dataBound event. If the dataSource filters do not include the "MultiSelect" filter (filter.field = name), the value in the dom element is cleared.

if(!_.find(this.dataSource.filter() ? this.dataSource.filter().filters : [] , 
                function(filter){
                    return filter.field == "name"
                }))
            $("#<<filterElementID>>").data().kendoMultiSelect.value([]);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for creating horizontal dividers with CSS in Vuetify using <v-divider> and <v-divider/> styling

Currently, I am working on a project using Vue.js and adding Vuetify. However, I need to use a component. .horizontal{ border-color: #F4F4F4 !important; border-width: 2px ; } <v-divider horizontal class=" horizontal ...

Exploring AngularJS: Retrieving data based on a specific ID from a JSON document

Within my controller class, I extract the ID of a specific user from the URL and pass it on to the OrderService. My goal now is to fetch the data associated with this ID from a JSON file. How can I accomplish this task? OrderCtrl 'use strict'; ...

At what point does javascript cease execution on a webpage following a hyperlink being tapped?

I am curious about the behavior of JavaScript code, specifically related to the usage of setTimeout(). When a user clicks on a link to navigate to another page, I wonder at what point the JavaScript code on the current page stops running and the code calle ...

Tips for avoiding the freezing of bootstrap-select scroll when a large number of options are present

I have integrated a bootstrap-select with a total of 1000 options. However, I am encountering an issue where when I attempt to scroll down the list of options, it only goes down approximately 60 options and then freezes in that position. Can anyone provi ...

Is there a way to ensure that the function within the 'for loop' is executed prior to sending the response in NodeJS?

Utilizing bluebird for this task, my main goal is to ensure that the function `get_like_status(email, results[i].id)` located at the end of the for loop runs before sending out the headers. Currently, I am encountering an issue where the array list retur ...

Prisma Hack: excluding properties in type generation

EDIT hiding fields in the TypeScript definitions may pose a hidden danger: inaccessible fields during development with intellisense, but accidentally sending the full object with "hidden" fields in a response could potentially expose sensitive data. While ...

Incorrectly resolving routes in the generate option of Nuxt JS's .env configuration file

Having trouble using Nuxt JS's 2.9.2 generate object to create dynamic pages as static files by referencing a URL from my .env file: nuxt.config.js require('dotenv').config(); import pkg from './package' import axios from 'a ...

"Troubleshooting a Node.js JWT issue in a React.js

I've been diving into backend development and recently created some small APIs. They all function perfectly in Postman, but I encountered an issue when attempting to execute this particular call const onSubmit = async () => { try { setIsL ...

Manipulate the timing of css animations using javascript

I am currently working with a progress bar that I need to manipulate using JavaScript. The demo of the progress bar has a smooth animation, but when I try to adjust its width using jQuery $($0).css({'width': '80%'}), the animation disap ...

File writing issues are plaguing NodeJS, with middleware failing to function as well

I am facing a challenge with my middleware that is supposed to write JSON data to a file once the user is logged in. However, I am encountering an issue where no data is being written to the file or displayed on the console when the function is executed. ...

grab the destination URL from the embedded frame

Thank you for your attention. I am working with three iframes spread across different HTML documents. Here is how they are organized: In the file iframemain.html, there is: <iframe src="iframeparent.html" width="100%" height="600"> </iframe> ...

Guide on sending a model to a Bootstrap modal from an MVC controller

After spending some time on this project, I believe I am getting close to a solution. My goal is to edit MVC application users using a Bootstrap modal and Angular for binding. I have set up a function in Angular to handle editing a user by passing their ID ...

What is the rationale behind angular-fullstack's decision to implement both put and patch requests in Express?

I recently stumbled upon an article discussing the distinctions between PUT and PATCH requests (Difference between put and patch). Though I've gained some clarity on the topic, there are still aspects that remain unclear to me. One of my major querie ...

PHP's json_encode function does not escape the single quote character

I am currently facing an issue with parsing a JSON encoded object in JavaScript. When I use JSON.parse(word_array);, it throws an error saying Uncaught SyntaxError: Unexpected identifier. Upon investigating, I discovered that the object word_array is miss ...

Angular 13's APP_INITIALIZER doesn't wait as expected

Recently, I have been in the process of upgrading from okta/okta-angular version 3.x to 5.x and encountered an unexpected bug. Upon startup of the application, we utilized APP_INITIALIZER to trigger appInitializerFactory(configService: ConfigService), whi ...

Is there a glitch preventing the connection between HTML and CSS in Notepad++ even though the link is correct?

I have encountered a puzzling situation that has left me scratching my head in confusion. Despite being a rookie, I've had experience with linking CSS files before and can't understand why it's not working this time around. This issue is per ...

Retrieve all users along with their respective posts, ensuring that each post is also accompanied by its corresponding comments in

In my Laravel project, I have set up Eloquent models for User, Post, and Comment. The relationships are as follows: User model public function posts(){ return $this->hasMany('App\Post'); } public function comments(){ return $t ...

struggling to retain data within scope when utilizing localstorage in angular

Currently, I am utilizing the fileReader to read a file, save the image in localStorage, and then display it on the view. In the controller: angular.module('App')controller('publsherProfileEditCtrl', ['$rootScope', '$sc ...

While attempting to import modules in Visual Studio Code, an error message appears stating "Unexpected token {"

Greetings! I am currently using Visual Code to run my project and would like to share my code with you. In the file external.js: export let keyValue=1000; In the file script.js: import {keyValue} from './external.js'; console.log(keyValue); ...

UI.Bootstrap - incorrect formatting of text

I am facing an issue with my code where, when I add a string containing HTML code, it does not display in the correct HTML format. Below is a snippet from my code: vm_main.test = "Documents" + "internet site <b><a href='http://www.g ...