Is it possible to customize the icon or color of the filter on a Kendo UI grid?

When I am filtering a kendo grid, I need to change the color of the "watering can" icon that appears above the columns. I have found a way to run my code on the filtering event:


var originalFilter = self.object.data("kendoGrid").dataSource.filter;
self.object.data("kendoGrid").dataSource.filter = function(e) {
if (e != undefined && e != null) {
var selector = 'th[data-field=' + e.filters[0].field + '] > a > span.k-filter';
$(selector).css('background-color', 'red');
return originalFilter.apply(this, arguments);
}
}

Using this method, I can change the background color of the icon. However, I encounter two problems: 1) After filtering, the value disappears. 2) I need to change the background color to red when a value is entered in the filter input and white when the value is empty. Could you please provide me with an example of code that will achieve this color change for the filter icon?

Answer №1

Revise the CSS style below:

.k-icon.k-filter {
    background: url('path to your image');
}

If you want to apply this change globally or limit it to a specific grid with an id of my_grid, use:

#my_grid .k-icon.k-filter {
    background: url('path to your image');
}

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

The Ajax form's malfunction is attributed to JSON, as it throws a parser error indicating a SyntaxError. Specifically, the JSON.parse function encounters an unexpected end of data at line 1, column 1

I understand that this is a commonly asked question, but I have tried all the solutions provided and none of them have worked for me. My specific issue is that I am unable to load a JSON response from the server using AJAX. Here's the setup: my "scrip ...

Updating Values in Nested Forms with Angular Reactive Form

I have been grappling with a form setup that looks something like this: itemEntities: [ {customisable: [{food: {..}, quantity: 1}, {food: {..}, quantity: 5}]}, {customisable: [{food: {..}, quantity: 0}]}, ] My challenge lies in trying to u ...

Exploring the use of @Query() object in Nest.js for iteration

How can we loop through an object passed to the controller using @Query() annotations? We are dealing with a varying number and names of query parameters in our GET request, so we require the entire @Query() object to iterate through and determine the exa ...

Utilize promise-style for Sequelize associations instead, please

I am in the process of merging information from 3 tables - Products, Suppliers, and Categories. My goal is to retrieve the row with SupplierID = 13. I recently came across a helpful explanation on How to implement many to many association in sequelize, whi ...

Insert text into the cursor location within Summernote using JQuery

Currently, I am working on a flutter application where I have implemented the summernote editor using JQuery. ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); String txtIsi = data.text .replaceAll("'", '\&bsol ...

What is the process for choosing a specific row?

I am currently working with a table that has the id "mytable" and contains numerous rows... My goal is to use jQuery to select a specific row with the id "row_100" in this table... How can this be accomplished? Here is the code snippet: function highli ...

Can dates in the form of a String array be transmitted from the server to the client?

Struggling to send a String array from the server side to the client using Nodejs and Pug. Encounter errors like "SyntaxError: expected expression, got '&'" or "SyntaxError: identifier starts immediately after numeric literal". Server runs o ...

Sizing of Info Windows for Google Map Markers

I've been trying to create a Google map displaying multiple locations, but I can't seem to figure out how to adjust the size of the infowindow for each marker. I've spent several hours on this with no luck. Can anyone show me where in this f ...

Is it possible to justify align inline-block elements across multiple lines?

I have encountered various scenarios where I need a DIV to contain an inline-block menu element - usually an anchor - and behave as if the elements are vertically justified, even when they overflow onto multiple lines. Let me illustrate with an example: ...

Manipulating elements with JavaScript to remove them, while ensuring that the empty space is automatically filled

Recently, I decided to enhance my understanding of JavaScript by experimenting with it on various websites. My goal was to use JavaScript to remove the right bar from a webpage and have the remaining body text automatically fill in the space left behind. ...

Is there a way to update the parent component when changes occur in the child component?

I have been working on a book tracking application that allows users to keep track of the books they have read or plan to read. The app is built using Vue.js on the front end and Express.js on the server side. It consists of three lists or categories for o ...

Converting N-API object to C++ basic data types through reading

I've been working on a N-API module by customizing the ObjectWrap boilerplate provided in generator-napi-module. So far, I have successfully passed an array containing objects with string, number, and boolean properties from native C++ code to JavaScr ...

Using Firebase callable functions with React Native

Can I use Firebase callable functions with React Native? I have successfully deployed an onCall function and it is visible in my dashboard. I have initialized the functions using: // Initialize Cloud Functions through Firebase firebase.functions(); The ...

Code for a regular expression that permits either letters or numbers with symbols

Here is the code snippet I am using for data validation in jQuery: return /^(?=.*[A-Za-z0-9/\$#.-_])[A-Za-z0-9/\$#.-_]$/i.test(value) The requirement is that the value should begin with letters or numbers, or a combination of both. Afterwards, ...

Adaptable and scalable

Hello everyone, I could use some assistance in identifying where I may have made errors. Can you please help me with that? I am aiming to enhance the responsiveness of the following design for mobile devices. <section class="hero"> ...

Iterate through the list of objects and display duplicates only once

var fixtures = [ { "matchday": 1, "homeTeamName": "Arsenal FC", "awayTeamName": "Leicester City FC" }, { "matchday": 1, "homeTeamName": "AFC Bournemouth", ...

Leverage the power of npm packages within a Flutter mobile app's webview

I am currently developing a Flutter mobile app and I am interested in incorporating an npm package that utilizes web3.js and offers additional custom features. My understanding is that Dart code in Flutter is not compiled to JavaScript, so I have been lo ...

I'm currently in the process of creating a snake game using HTML5. Can you help me identify any issues or problems that

I am experiencing an issue where nothing is appearing on the screen. Below are the contents of my index.html file: <html> <body> <canvas id="canvas" width="480" height="480" style="background-color:grey;"></canvas> <script src=" ...

Employ the CSS pseudo-element :before within a UL element to generate a vertical line

I'm currently working on a vertical menu with the capability of having submenus. My aim is to include a vertical line using CSS pseudo-element ::before along with border. The challenge I'm encountering is that the CSS is applying to the entire m ...

Text alignment in the horizontal direction does not function as expected within the `<span>` element in Bootstrap 4

The code snippet below is what I am currently working with: <div class="card" > <div class="card-block"> <h4 class="card-title"> <span class="text-left"> ...