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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:52:44+00:00 2026-05-23T12:52:44+00:00

Background I’ve picked up some incomplete work from another developer that involves displaying the

  • 0

Background

I’ve picked up some incomplete work from another developer that involves displaying the results of a search. His approach was to render the results in an HTML table using inline Javascript and jQuery as follows.

Grid using table and inline Javascript

I’m trying to finish off the work but I would prefer to write less code and use the jqGrid because it includes sorting functionality, and to get the code tidier. Getting the jqGrid to display the results is easy, but getting the radio buttons in a blank column is harder than I thought it would be.

The version of jqGrid in the application is 3.7.2. The grid needs to have radio buttons on the left for selection to keep things consistent with the rest of the application.

Where I’m stuck

There doesn’t seem to be a way to have an unbound column in jqGrid. That is, each column seems to need a field in the underlying data. If you do not have a dummy field, then the row data and column headers become misaligned.

I’ve come across an example (See Row Editing -> Custom Edit) that returns JSON with a dummy field in the data, and then modifies the grid data to insert buttons.

My preference is to not have the dummy data in there, because it feels dirty 🙂 I would like my JSON to only include the data it needs to represent the results of the search. So I was thinking that it would be better to add the dummy field in the script code instead in order to keep the code on the server side clean.

I’m trying to modify the data returned from the AJAX call before jqGrid renders it. I’ve tried hooking into the loadComplete event but when I modify the data it appears to be after it has already rendered.

I’ve also tried hooking into the success event on the ajaxGridOptions field of options but that seems to totally override the event and jqGrid doesn’t render the data.

How can I modify the data returned from a web service call before jqGrid renders it?

  • 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-23T12:52:44+00:00Added an answer on May 23, 2026 at 12:52 pm

    The solution in my previous answer broke sorting so I came up with another solution.

    Because jqGrid doesn’t provide the hooks to conveniently modify the data, it was necessary to drop back a level and hook into jQuery. I replaced the $.ajax() method with my own. Firstly it checks whether the operation is one being initiated by jqGrid and if so, it pads the data, calls the original jqGrid success handler, and then adds the radio buttons to the grid. Sorting still works, the datatype is still json, and there are no manual calls to addJSONData and I am still able to achieve what I needed from the previous solution. Essentially, making this small jQuery hack allows me to get by without making any jqGrid hacks which is far messier.

    // Set up $.ajax() hook for modifying the data before jqGrid receives it
    if (!this._ajaxOverridden) {
        var oldAjax = $.ajax;
        $.ajax = function (options) {
            // Check whether this call is from jqGrid to our web service
            if (options.url == config.eventSearchUrl && options.success) {
                // Wrap the success event handler with our own handler that pads the data and creates the radio buttons
                var oldSuccess = options.success;
                options.success = function () {
                    thisEventSearchDialog._padData(arguments[0]);
                    oldSuccess.apply(this, arguments);
                    thisEventSearchDialog._createRadioButtons();
                }
            }
            oldAjax(options);
        };
        this._ajaxOverridden = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have a web app that will create an image from user input.
Background: At my company we are developing a bunch applications that are using the
Background: Some time ago, I built a system for recording and categorizing application crashes
Background I work for a large organization which has thousands of MS Access applications
Background: writing an automated release script to export changed files between versions from SVN
background-position: -200px 0; one site says it crops an image from the bottom and
Background: I have a MainTest class that has many buttons, each of which instantiate
Background: I've implemented a stochastic algorithm that requires random ordering for best convergence. Doing
Background: I have a little video playing app with a UI inspired by the
Background: I need to reserve an amount of memory below 0xA0000 prior to my

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.