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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:31:52+00:00 2026-05-29T22:31:52+00:00

My use of the grid involves sorting while having a few rows in inline

  • 0

My use of the grid involves sorting while having a few rows in inline edit mode.

The questions would be:

  1. Is there any way to execute sorting, while inline editing one or more rows?

  2. If not, is there an event that will jump when I click the column headers while inline editing one or more rows?(an event where I can maybe remove the editing, before sorting the contents)

Thanks, Catalin

  • 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-29T22:31:55+00:00Added an answer on May 29, 2026 at 10:31 pm

    An interesting question! +1 from me.

    The problem with sorting of editing rows or cells consists in the access to the contain of the editing cells. The current code of jqGrid don’t do this and so inside of the click event handler on the column headers there are test whether there are any editing line in the grid. If some editing line/lines exist then the sorting will be stopped without to call of onSortCol callback.

    So only the second way where one save or restore the editing cells before sorting is possible. To implement this there are one small problem. If one bind additional click event on the column headers it will be called after the previous bound standard handler of jqGrid. So one can’t save or discard the editing changed before the click event will be processed. One can fix the problem in two ways: either one can call sortData function of from the new event handler or one should change the order of bindings to the click event. The following code demonstrate the second approach:

    $.each($grid[0].grid.headers, function () {
        var $th = $(this.el), i, l, clickHandler, clickHandlers = [],
            currentHandlers = $th.data('events'),
            clickBinding = currentHandlers.click;
    
        if ($.isArray(clickBinding)) {
            for (i = 0, l = clickBinding.length; i < l; i++) {
                clickHandler = clickBinding[i].handler;
                clickHandlers.push(clickHandler);
                $th.unbind('click', clickHandler);
            }
        }
        $th.click(function () {
            var p = $grid[0].p, savedRow = p.savedRow, j, len = savedRow.length;
            if (len > 0) {
                // there are rows in cell editing or inline editing
                if (p.cellEdit) {
                    // savedRow has the form {id:iRow, ic:iCol, name:nm, v:value}
                    // we can call restoreCell or saveCell
                    //$grid.jqGrid("restoreCell", savedRow[0].id, savedRow[0].ic);
                    $grid.jqGrid("saveCell", savedRow[0].id, savedRow[0].ic);
                } else {
                    // inline editing
                    for (j = len - 1; j >= 0; j--) {
                        // call restoreRow or saveRow
                        //$grid.jqGrid("restoreRow", savedRow[j].id);
                        $grid.jqGrid("saveRow", savedRow[j].id);
                    }
                }
            }
        });
        l = clickHandlers.length;
        if (l > 0) {
            for (i = 0; i < l; i++) {
                $th.bind('click', clickHandlers[i]);
            }
        }
    });
    

    where $grid are defined as var $grid = $("#list"). You can see live how it works on the following demo.

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

Sidebar

Related Questions

We use a grid control from Infragistics at work. Are there others? Pay or
I'm trying to figure out why I would use a grid system. I have
For WPF/Silverlight layout, is it better to use a Grid with lots of rows
In my application I use a Grid. The Grid has some rows and 5
i am having a concept like i want to use grid view inside another
We use Grid Control 10.2.0.4, with a catalog repository database also at 10.2.0.4. It
I want to create a really easy to use 2D Grid. Each cell in
I'm writing a windows C# application which I wish to use data grid views,
Seen various examples of WPF applications I've seen the use of the Grid control
What grid library does swivel.com use? It looks pretty nice. Is it made inhouse?

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.