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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:03:23+00:00 2026-05-30T20:03:23+00:00

Simple question. Is there a function to get the current sort position of a

  • 0

Simple question. Is there a function to get the current sort position of a column by name in a grid?

  • 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-30T20:03:24+00:00Added an answer on May 30, 2026 at 8:03 pm

    The indexes used in the remapColumns method are the same as in the colModel array. It’s important to understand, that the indexes can be different as in the colModel parameter of jqGrid used initially. If jqGrid uses options rownumbers: true an additional column with the name 'rn' will be inserted at the first place of colModel array. The indexes of all other elements of colModel array will be incremented. In the same way the option multiselect: true inserts the column 'cb' abd the option subGrid: true inserts the column 'subgrid'. In the same way the option treeGrid: true follows appending colModel array with some additional hidden columns which names can be defined by treeReader. The default names of the columns in case of treeGridModel: 'nested' are: 'level', 'lft', 'rgt', 'isLeaf', 'expanded', 'loaded' and 'icon' or 'level', 'parent', 'isLeaf', 'expanded', 'loaded' and 'icon' in case of treeGridModel: 'adjacency'.

    So to find the index of the column by the name you should just get the current colModel, look through the items and find the item where 'name' property are the column name which you need. To get colModel you can use $("#grid")[0].p.colModel or $("#grid").jqGrid('getgridParam', 'colModel'). So the code can be like the following:

    var getColumnIndexByName = function (columnName) {
            var cm = $(this).jqGrid('getGridParam', 'colModel'), i, l = cm.length;
    
            for (i = 0; i < l; i++) {
                if (cm[i].name === columnName) {
                    return i; // return the index
                }
            }
            return -1;
        };
    

    and the usage like

    var $grid = $("#grid"),
        iCol = getColumnIndexByName.call($grid[0], 'myColName');
    

    To get the name of the current sorted column you can use $grid.jqGrid('getGridParam', 'sortname')

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

Sidebar

Related Questions

My question is simple. Is there a PHP's preg_match() function equivalent in the C++
This is a simple question : Is there any automatic indentation alignment on Eclipse
Simple question here: is there any way to convert from a jagged array to
a simple question here Is there a way to change the text click here
Simple question. Are there any tools for generating Xcode projects from the command line?
Simple question, but one that I've been curious about...is there a functional difference between
Very simple question, is there any cloud server enviroments avaliable these days for us
Sorry for the simple question but I feel like there's a smarter way to
I have a simple question. Is there a way ( using reflections I suppose
I have a simple question about Java's XML API and I hope there's 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.