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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:49:12+00:00 2026-05-20T11:49:12+00:00

I have a jqGrid with multiselect. I would like to be able to pre-check

  • 0

I have a jqGrid with multiselect.
I would like to be able to pre-check a certain number of rows if another column is true, for example.
What I’ve done so far is passing an element (column) from the server which contains a boolean.
I hide this column in the gridComplete event.
I can I select – and check a predefined row during the load of the grid?

UPDATE:

This is my code:

jQuery("#OrdersGrid").jqGrid({
    url: $.SalesOrders.url.OrdersFetchUrl,
    postData: { OrderStatus: orderStatus },
    datatype: 'json',
    mtype: 'POST',
    colNames: ['N.Ordine', 'Cliente', 'Ragione Sociale', 'Stato', 'Fido', 'Data', ''],
    colModel: [
               { name: 'Number', index: 'Number', editable: false, resizable: true, sortable: false, width: 76, align: 'left' },
               { name: 'CustomerCode', index: 'CustomerCode', editable: false, resizable: true, sortable: false, width: 50, align: 'left' },
               { name: 'CustomerName', index: 'CustomerName', editable: false, resizable: true, sortable: false, width: 410, align: 'left' },
               { name: 'Status', index: 'Status', editable: false, resizable: true, sortable: false, width: 40, align: 'center' },
               { name: 'LoCStatus', index: 'LoCStatus', editable: false, resizable: true, sortable: false, width: 40, align: 'center' },
               { name: 'Date', index: 'Date', editable: false, resizable: true, sortable: false, width: 70, align: 'right' },
               { name: 'Checked', index: 'Checked', editable: false, resizable: false, visible: false }
              ],
    pager: $('#OrdersPager'),
    rowNum: 30,
    width: 794,
    height: 220,
    viewrecords: true,
    shrinkToFit: false,
    scroll: true,
    rownumbers: true,
    hidegrid: false,
    multiselect: true,
    emptyrecords: "Nessun record presente",
    loadComplete: function (data) {
        if (data.rows.length > 0) {
            for (var i = 0; i < data.rows.length; i++) {
                if (data.rows[i].cell[6] == 'true') {
                    jQuery("#OrdersGrid").jqGrid('setSelection', data.rows[i].id, true);
                }
            }
        }
        jQuery("#OrdersGrid").jqGrid('hideCol', 'Checked');
    }
});

I’ve implemented Oleg’s solution and it works like a charm.

  • 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-20T11:49:13+00:00Added an answer on May 20, 2026 at 11:49 am

    You don’t posted the definition of the grid which you use, so some questions for me stay opened. Nevertheless I hope that you will find the answer on your question here. In the demo included in the answer are used the parameter loadonce:true which makes all more complex. The rows which will be selected are not on the first page of the loaded data. Moreover, in the demo there are no columns (even hidden) which can be used to determine which rows should be selected. Instead of that the information about the selection in the grid will be sent from the server as a part of userdata part of the JSON response. This way is more general and I hope it will work also in your grid.

    UPDATED: I find your code good. I seen only small places for optimization:

    1. The properties editable: false, resizable: true and align: 'left' are default in the colModel (see jqGrid documentation). So I suggest you to remove the values.
    2. The property visible: false don’t exist in the colModel. You mean probably hidden: true. After the usage of correct property the statement jQuery("#OrdersGrid").jqGrid('hideCol', 'Checked'); will be not needed in the loadComplete.
    3. Instead of the usage jQuery("#OrdersGrid") every time in the loop you can save the value in a variable: var mygrid = jQuery("#OrdersGrid"); before jqGrid initialization and then your code will be mygrid.jqGrid({...,loadComplete: function (data) {...mygrid.jqGrid('setSelection', ...

    Some additional remarks. The statement data.rows[i].cell[6] = 'true' shows that you serialize Checked property with Checked.ToString(). You can use Checked?"1":"0" instead and reduce the size of the data transfered. I use many grids with the formatter:"checkbox" which interpret both “1” and “true” like checked. In your case you are absolutely free in the format of data, so you can use “1” and “0” or even “1” and “”.

    If you use Checked column only to transfer the information about row selection you can remove Checked column from the grid at all. In the data parameter of loadComplete you will still see the Checked property (the data.rows[i].cell[6]), but you reduce the number of columns.

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

Sidebar

Related Questions

I have a jqGrid with multiselect:true. In a click event of a button I
Experts, I have JQGrid with custom template column like Edit. the following screen display
Its like I have multiselect option in Jqgrid in which i want to pass
I have the below jqgrid image, from which I would like to remove the
I have a jqGrid in an ASP.NET MVC View with the option multiselect:true .
I have a jqGrid with which users will select records. A large number of
I hope you have a good morning. I'd like to use jqGrid in my
I have a JQGrid with loadonce:true(so it's all client side) and paging enabled(with, say
I have a jqGrid where the View icon is enabled (view:true), so that a
I have a jqGrid where I want all the rows to be in edit

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.