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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:56:55+00:00 2026-05-26T19:56:55+00:00

I am using jqgrid in ‘multiselect’ mode and without pagination. When the user selects

  • 0

I am using jqgrid in ‘multiselect’ mode and without pagination. When the user selects individual records by using mouse click, is there any way that I can bring those selected records to the top of the grid?

Thanks in advance for your help.

  • 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-26T19:56:55+00:00Added an answer on May 26, 2026 at 7:56 pm

    After small discussion with you in comments I could reformulate your question so: “how one can implement sorting by multiselect column?”

    The question find is very interesting so I invested some time and could suggest a solution in case of jqGrid which hold local data (datatype which is not ‘xml’ or ‘json’ or which has ‘loadonce: true’ option).

    First of all the working demo which demonstrate my suggestion you can find here:

    enter image description here

    The implementation consist from two parts:

    1. Making selection as part of local data. As the bonus of the selection will be hold during paging of local data. This feature is interesting independent on the sorting by multiselect column.
    2. The implementation of sorting by multiselect column.

    To implement of holding selection I suggest to extend local data parameter, which hold local data with the new boolean property cb (exactly the same name like the name of the multiselect column). Below you find the implementation:

    multiselect: true,
    onSelectRow: function (id) {
        var p = this.p, item = p.data[p._index[id]];
        if (typeof (item.cb) === "undefined") {
            item.cb = true;
        } else {
            item.cb = !item.cb;
        }
    },
    loadComplete: function () {
        var p = this.p, data = p.data, item, $this = $(this), index = p._index, rowid;
        for (rowid in index) {
            if (index.hasOwnProperty(rowid)) {
                item = data[index[rowid]];
                if (typeof (item.cb) === "boolean" && item.cb) {
                    $this.jqGrid('setSelection', rowid, false);
                }
            }
        }
    }
    

    To make ‘cb’ column (multiselect column) sortable I suggest to do following:

    var $grid = $("#list");
    
    // ... create the grid
    
    $("#cb_" + $grid[0].id).hide();
    $("#jqgh_" + $grid[0].id + "_cb").addClass("ui-jqgrid-sortable");
    cbColModel = $grid.jqGrid('getColProp', 'cb');
    cbColModel.sortable = true;
    cbColModel.sorttype = function (value, item) {
        return typeof (item.cb) === "boolean" && item.cb ? 1 : 0;
    };
    

    UPDATED: The demo contain a little improved code based on the same idea.

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

Sidebar

Related Questions

I am using jqgrid and have simple searching enabled. I am wondering if there
I am using jqgrid and using the inline editing mode and can't figure out
I am using jqGrid with ui.multiselect.js for column choosing and reordering. The dialog which
I am using jqGrid . Pagination is not getting reflected, what could be the
Using jqGrid I want to open a cell-editor on double-click , so my code
We are using jqGrid searching .. how can you determine if a user has
I am using jqGrid ( http://www.trirand.com/blog/ ) to display some read-only data. The resizeable
I'm having an issue in IE 6 and 7 when using jqGrid (v3.6.4) and
Greetings, I have a problem using jqgrid and jquery tab (I am coding in
How can I find the current page number in jqGrid (using jQuery of course).

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.