Unexpected Error in Applying Color to Rows in EXTJS Grid

Currently, I am utilizing extjs 3.2 and recently experimented with a sample for coloring grid rows by referring to . I added a grid view configuration in the gridExample.js file which holds a static grid.

    viewConfig: { 
    stripeRows: false, 
    getRowClass: function(record) { 
        return record.get('age') < 18 ? 'child-row' : 'adult-row'; 
    } 

I also included CSS in the HTML page.

The HTML code is as follows:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>success</title>
<link href="/testing/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<link href="/testing/ext/resources/css/test.css" rel="stylesheet" type="text/css" />
<style>
.child-row .x-grid-cell { 
    background-color: #ffe2e2; 
    color: #900; 
}  
.adult-row .x-grid-cell { 
    background-color: #e2ffe2; 
    color: #090; 
}
</style>
<script src="/testing/ext/adapter/ext/ext-base.js"></script>
<script src="/testing/ext/ext-all.js"></script>
<script src="/testing/JS/gridExample.js"></script>
</head>
<body>
</body>
</html>

Despite following advice from numerous forums, the grid row colors remain unchanged. Is there possibly an issue with the CSS on the HTML page? Thank you for any assistance provided in advance.

Answer №1

In Ext 3.x, the CSS classes used for grid elements are in the form of x-grid3-.... To see how this works, you can take a look at the markup of this example from version 3.2.

Therefore, your CSS code should look something like this:

.child-row .x-grid3-cell { 
    background-color: #ffe2e2; 
    color: #900; 
}  

Answer №2

To achieve a similar effect, I found it necessary to include !important in those attributes.

.child-item .x-table-cell { 
    background-color: #ffe2e2 !important; 
    color: #900 !important; 
} 

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

Implement ajax functionality to update an object within a JSP page

On my JSP page, I have implemented an accordion list (utilizing Bootstrap 3) with text and a Delete button within each node. When the user clicks on the delete button, that specific list item is removed. To construct the accordion list, I bring in an Array ...

Issue with Refreshing onRowAdd in React Material Table

I am currently using Material Table to display my table data. However, when I use the onRowAdd function to add a new row, the page does not refresh properly. Instead, it reloads and gets stuck, requiring me to manually refresh again. newData => ...

qunit timer reset

I have developed a user interface for manually launching qunit tests. However, I have noticed that the qunit test timer starts when displaying the interface, rather than when starting the actual test. For example: var myFunction = function (){ test ...

Is there a way to create Angular components sourced from an external library using JavaScript?

I'm currently developing an Angular project and leveraging an external component library called NGPrime. This library provides me with a variety of pre-built components, including <p-button> (which I am using in place of a standard <button> ...

Having issues with resolving or rejecting promises when using $http get requests

I am facing a challenge in rejecting a deferred object within a $http.get call as it is not getting properly rejected. The error callback does not get triggered, and I'm struggling to understand why this is happening. Here is an outline of what my cod ...

Troubleshooting: Vue component does not refresh data when a function is

In my application, I have created two Vue components: Vue.component('event', { props:['event'], template: ` <span class="pointer" @click="showModal = true"> {{event.evname}} <modal @hide ...

Retrieving data for a route resolver involves sending HTTP requests, where the outcome of the second request is contingent upon the response from the first request

In my routing module, I have a resolver implemented like this: { path: 'path1', component: FirstComponent, resolve: { allOrders: DataResolver } } Within the resolve function of DataResolver, the following logic exists: re ...

React Native's fetch function appears to be non-responsive

I am experiencing an issue where the fetch function does not seem to fire in my React Native component: import { Button } from 'react-native'; export function Test() { function submit() { console.log('submit'); fetch('h ...

Testing Restful API Endpoints and Code Coverage with Node.js using Mocha

My time in Istanbul has been delightful, and I've been dabbling in different Node.js coverage libraries. However, I'm facing a challenge. Most of my unit tests involve making HTTP calls to my API, like this: it('should update the custom ...

Ways to properly close open HTML tags using node.js?

Have you ever encountered a situation where user-entered content from a database or similar source only contains the opening tag without the closing tag? This can disrupt the layout of your website. Is there a way to fix this issue using Node.js on the s ...

I must remove the thumb from the input range control

I am looking for a way to remove the thumb from the progress bar in my music player. I have tried various methods without success, and I simply want the progress bar to move forward with color change as it advances based on the Progress variable. For refe ...

Sticky positioning for dropdown menu in table column body

Greetings, I need some assistance with a formatting issue. My goal is to make the first and second columns of my table sticky by applying a "sticky" position to them. However, one of the columns contains a dropdown menu and the problem is that the content ...

I am having trouble getting all the HTML content to properly display in the GitHub zip file

I am encountering an issue where the index.html file is not displaying the navigation or images as expected. For reference, the project can be found at https://github.com/LawlietBlack/Persona-4-Golden-Guide If there is a more appropriate place to ask this ...

Best practices for structuring npm scripts and multiple webpack configurations

My project consists of multiple dashboards, and I've decided to create separate scripts in my package.json for each one. Building all the dashboards during development when you only need to work on one can be time-consuming. So, I discovered that it&a ...

Combining Option Value and Name Selection Using React Hooks

Currently, I am facing a situation where I need to retrieve two different values (item.id and item.name) to set the State when selecting an item from my dropdown menu. Right now, I am only able to do this for one value (item.id). Is it possible to achieve ...

Javascript Error: Page reload interrupted by Broken Pipe IOError [Errno 32]

I am facing an issue with my javascript function that sends a signal to my flask app for recalculating figures using ajax. Upon successful figure production, I want to reload the page with updated figures by adding a version number to the filename (using & ...

Ensure to update the canvas prior to the function finishing

Is there a way to update the canvas element while inside a JavaScript function without waiting for the function to return? It can be frustrating when you want to keep the function running but also need to update the canvas element in real time. ...

How can I modify the appearance of the bootstrap scrollbar with scrollspy?

I'm struggling to modify the color of the scrollbar in Bootstrap scrollspy despite having a functional scrollbar. Here is an example of my code: HTML: <body> <div class="container, scrollbar" id="myScrollspy"> <div class=" ...

positioning two out of three items in a navigation menu to the right and the remaining one to the left

I am looking to design a navigation bar that spans the full width of the screen, with the logo on the left side serving as a link back to the home page. Additionally, I want to include elements for register/login and cart. The background color should cove ...

What is the best way to implement multiple ternary operators within HTML code?

Consider the following code snippet: It currently applies CSS classes up to red4, but I want to apply CSS classes up to red11. Additionally, the variable "size" in myData should be dynamic. For example, size could range from 0-20 // 0-100 // 0-10000, etc., ...