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

  • Home
  • SEARCH
  • 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 7660339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:27:09+00:00 2026-05-31T13:27:09+00:00

Using answer from Set rownumbers to false dynamically in jqgrid I created row numbers

  • 0

Using answer from Set rownumbers to false dynamically in jqgrid I created row numbers toggle button.
Initially row numbers are not shown. Button click is ignored, row numbers column is not added.
How to force button to add row number column ?
Or is it possible to add option to column chooser to toggle row number columns ? This would be better, not additional button is required.

 var rownumbers=  isColState ? myColumnsState.rownumbers : false;
 $("#grid_toppager_left table.navtable tbody tr").append(
        '<td class="ui-pg-button ui-corner-all">' +
            '<div class="ui-pg-div my-nav-checkbox">' +
            '<input tabindex="-1" type="checkbox" id="RowNumbers" ' + (rownumbers ? 'checked ' : '')+'/>' +
            '<label title="Toggle row numbers"' +
            ' for="RowNumbers">Toggle row numbers</label></div></td>'
    );
 $("#RowNumbers").button({
        text: false,
        icons: {primary: "ui-icon-grip-dotted-vertical"}
    }).click(function () {
        rownumbers = !rownumbers;
        if (rownumbers ) {
          $grid.jqGrid('showCol', 'rn'); 
         } else { 
          $grid.jqGrid('hideCol', 'rn'); 
          }
       saveWindowState();
    });

Update

jqgrid contains also multiselect and _actions columns. in loadcomplete new row is added to end of grid using

var newRowData = { Dokumnr: 123,
    Reanr: $grid[0].rows.length + 1
},
newRowId = '_empty' + $.jgrid.randId();
$grid.jqGrid('addRowData', newRowId, newRowData);

If row numbers are turned on in first time after load, multiselect column checkbox in added row appears in rown numbers column:

checkbox in row number column

How to fix this ?

  • 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-31T13:27:09+00:00Added an answer on May 31, 2026 at 1:27 pm

    You have to include rownumbers: true in any way to create the row numbers. If you want that row numbers are initially not shown you should call $grid.jqGrid('hideCol', 'rn'); after the grid is created. You can additionally set rownumbers to false with respect of $grid.jqGrid('setGridParam', {rownumbers: false});, but I don’t think that it’s really required.

    After that you can use the button $("#RowNumbers") like you as wanted initially. Probably you can consider to set rownumbers option to true or false together with showCol and hideCol and use the rownumbers option instead of your rownumbers variable.

    UPDATED: The current code of addRowData just test whether rownumbers option of jqGrid is true:

    var ni = t.p.rownumbers===true ? 1 :0;
        gi = t.p.multiselect ===true ? 1 :0;
        si = t.p.subGrid===true ? 1 :0;
    

    Depend on the value it calculate the position of the data:

    prp = t.formatCol(ni,1,'', null, rowid, true);
    

    So I should correct my answer. You should not change the value of rownumbers option. It should stay always true even if the corresponding column will be hidden.

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

Sidebar

Related Questions

Similar to my question about returning from inside a using statement (whose answer was
I am trying to integrated linkedIn using this question answer Posting LinkedIn message from
Using this answer , I created a sample localized app. My question is, is
[sqlite executeQuery:@UPDATE UserAccess SET Answer ='Positano';]; NSArray *query2 = [sqlite executeQuery:@SELECT Answer FROM UserAccess;];
I'm finally set up to be able to work from home via VPN (using
SEE BELOW FOR SOLUTION BASED ON ANSWER/COMMENT from @Bertrand Le Roy ORIGINAL QUESTION: Not
By using normal minus '-' function between two timestamps, the answer given from oracle
Im using the answer to this question to convert an array of XML to
I know that this has already been asked here but the answer (using a
I have an open socket to a remote terminal. Using the answer to Force

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.