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 7177905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:48:40+00:00 2026-05-28T16:48:40+00:00

Answer in how to make sort icons visible in all column headers in jqgrid

  • 0

Answer in

how to make sort icons visible in all column headers in jqgrid regardless on sort status

describes how to add sortable indication to columns.

It is difficult to distinguish sorted and unsorted column by default sort indicator.

How to underline sorted column header text in addidion to sort indicator ?

  • 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-28T16:48:41+00:00Added an answer on May 28, 2026 at 4:48 pm

    I modified the demo from the previous answer to the following which display now

    enter image description here

    I used for the demo the CSS class where I additionally to underlining changed the color of the text

    .sortedColumnHeader > div { text-decoration: underline; color: blue; }
    

    If we play forward we can use just the ‘ui-state-highlight’ for the highlighting (see another demo). The column header will be probably even too much distinguish from the standard column:

    enter image description here

    The corresponding code is

    var $grid = $("#list"), colModel, sortName;
    
    // create the grid
    $grid.jqGrid({
        // all typical jqGrid parameters
        onSortCol: function (index, idxcol, sortorder) {
            if (this.p.lastsort >= 0 && this.p.lastsort !== idxcol
                    && this.p.colModel[this.p.lastsort].sortable !== false) {
                // show the icons of last sorted column
                $(this.grid.headers[this.p.lastsort].el)
                    .find(">div.ui-jqgrid-sortable>span.s-ico").show();
                $(this.grid.headers[this.p.lastsort].el).removeClass('sortedColumnHeader');
            }
            $(this.grid.headers[idxcol].el).addClass('sortedColumnHeader');
        }
    });
    
    // show sort icons of all sortable columns
    colModel = $grid.jqGrid('getGridParam', 'colModel');
    sortName = $grid.jqGrid('getGridParam', 'sortname');
    $('#gbox_' + $.jgrid.jqID($grid[0].id) +
        ' tr.ui-jqgrid-labels th.ui-th-column').each(function (i) {
        var cmi = colModel[i], colName = cmi.name;
    
        if (cmi.sortable !== false) {
            // show the sorting icons
            $(this).find('>div.ui-jqgrid-sortable>span.s-ico').show();
        } else if (!cmi.sortable && colName !== 'rn' && colName !== 'cb' && colName !== 'subgrid') {
            // change the mouse cursor on the columns which are non-sortable
            $(this).find('>div.ui-jqgrid-sortable').css({cursor: 'default'});
        }
        if (cmi.name === sortName) {
            $(this).addClass('sortedColumnHeader');
        }
    });
    

    At the end I want to reference one more old answer where it’s shown another sophisticated method to highlight the sorted column.

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

Sidebar

Related Questions

I don't normally make this sort of question / answer, but figured I'd do
The answer to What is the correct way to make exceptions serializable? says that
I can't seem to find an answer on this and just want to make
PERL? Perl? perl? What's good style? I know the answer—I just wanted to make
i think i sort of know the answer to this, but there are always
I know something like this has been asked before, but the answer was sort
I'm trying to make a sort of game using the HTML5 canvas, JavaScript and
I always believe they did, but seeing some answers here make me doubt... Can
ANSWER: If you ever see these lines and are mistified like I was, here's
Answer : Implemented using Curl... $file = http://abc.com/data//output.txt; $ch = curl_init($file); $fp = @fopen(out.txt,

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.