Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7088741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:50:17+00:00 2026-05-28T07:50:17+00:00

I have a jqgrid with a subgrid. I am attempting to apply different colors

  • 0

I have a jqgrid with a subgrid.

I am attempting to apply different colors to master and detail grids. I have two rules: the first one is to alternate odd and pair colors and the other one is to apply specific CSS to the row, based on values of a specific field.

Both master & details grid, contains the following gridComplete functions, where obviously childnodes index varies cause tables contains different fields:

gridComplete: function () {
            var _rows = $(".jqgrow");
            for (var i = 0; i < _rows.length; i++) {
                _rows[i].attributes["class"].value += " " + _rows[i].childNodes[4].textContent;
                _rows[i].attributes["class"].value += " " + _rows[i].childNodes[4].innerText;
            }
           applyZebra("jqTicketgrid");
        }

applyZebra function provides to alternate odd/pair colours and has already been tested on another grid which not contains a subgrid.
For the record, I found above solutions in other solved questions of this forum, and both works with “simple” jqgrids (not master/detail).

PROBLEM
The master grid is formatted only when I click to expand the detail rows, while detail subgrid never alternate colours, neither apply format based on cell contents…

Where I am wrong? Pheraps I must intercept another event which is not gridComplete? Otherwise with grid&subgrids it’s impossible to use _rows[x] & childNodes[y] attributes?

Please ask for clarifications, if needed, thx.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:50:17+00:00Added an answer on May 28, 2026 at 7:50 am

    I suppose the error in your code is that you use $(".jqgrow") instead of $(".jqgrow", this) where this inside of gridComplete will be either DOM element of the <table> of the grid or the subgid (I suppose you use grid as subgrid).

    Additionally I would not recommend you to use you current code at all. It’s much more effective and simple to to use cellattr. The rawObject parameter allow you access all other cells of the current row. In the answer you will find an example of implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have jqGrid with two columns, one being hidden. For some reason in FireFox
I have a jqgrid with a subgrid that has one row. Right now every
I have a jqGrid with a subgrid. I want to sort the subgrid so
I have a jqgrid that has a subgrid. How can I expand the subgrid
I have a page that uses jqGrid with grids as subgrids. I also have
I have jqgrid and in that I have one custom navigation button to export
Hi I have a jqgrid with a subgrid which calls into a servlet. I
I have a jqGrid (4.1.1) using a simple subgrid. When a record is plus-ed
I have a jqGrid that can be sorted by different columns both in ascending
Is it possible to set to a jqGrid subgrid a footerrow. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.