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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:20:41+00:00 2026-05-27T23:20:41+00:00

After a user edits data in jqGrid, I would like to return a formatted

  • 0

After a user edits data in jqGrid, I would like to return a formatted JSON string back to the server to be consumed.
Below is a sample of what the server expects to receive:

{
  "aptitudeArrayList":[
    {
      "skill":"VITS",
      "value":2,
      "id":2,
      "color":"RED"
    },
    {
      "skill":"GBFM",
      "value":6,
      "id":1,
      "color":"GREEN"
    },
    {
      "skill":"JSON",
      "value":4,
      "id":3,
      "color":"RED"
    },
    {
      "skill":"CASTLEROCK",
      "value":7,
      "id":4,
      "color":"RED"
    }
  ],
  "cell":12412,
  "line":"FIRST_LINE",
  "name":"Barop",
  "id":1,
  "region":"The end",
  "available":true
}

Here is a segment of my ColModel:

...
{
    name:'cell',
    label:'Cell #',
    width:80,
    align:'center',
    editable:true,
    editrules:{required:true, integer:true},
    editoptions:{size:10, maxlength:10}
},
{
    name:'available',
    label:'Available',
    formatter:'checkbox',
    width:46,
    align:'center',
    editable:true,
    edittype:'checkbox',
    editoptions:{value:"true:false"}
},
{
    name:"vits.value",
    label:'VITS',
    width:300,
    align:'center',
    editable:true,
    jsonmap:"aptitudeArrayList.0.value"
},
{
    name:"vits.color",
    editable:true,
    jsonmap:"aptitudeArrayList.0.color"
}
...

Here are the Edit options: (I commented out postdata as its not needed as of now)

var editOptions = {
    onclickSubmit:function (params, postdata) {
        params.url = URL + '/'; //+ postdata.id;
    }
};

After the edit is called, the data is sent to this function:

$.extend($.jgrid.edit, {
    closeAfterEdit:true,
    closeAfterAdd:true,
    ajaxEditOptions:{ contentType:"application/json" },
    mtype:'PUT',
    serializeEditData:function (data) {
        delete data.oper;
        return JSON.stringify(data);
    }
});

The inadequate code above returns this JSON:

{
  "id":"1",
  "name":"Barop",
  "region":"The end",
  "line":"FIRST_LINE",
  "cell":"12412",
  "available":"true",
  "vits.value":"2",
  "vits.color":"RED"
  ...
}

When I attach the debugger I find that data contains: dataObject { id="1", name="Barop", region="The end", ... vits.value="2", vits.color="RED"} It seems it is getting the keys from the name attribute in jqGrid.

How would I go about serializing my data to a format that the server requires?

  • 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-27T23:20:42+00:00Added an answer on May 27, 2026 at 11:20 pm

    The simplest way to solve your problem seems to me the modification of the serializeEditData which you use. It can be about the following

    serializeEditData: function (data) {
        return JSON.stringify({
            id: parseInt(data.id, 10),
            name: data.name,
            line: data.line,
            cell: parseInt(data.cell, 10),
            available: data.available === 'true',
            aptitudeArrayList: [
                value: data.value,
                color: data.color
            ]
        });
    }
    

    Moreover I recommend you better not use points or any other meta-characters in the name property. Either you can just rename name: "vits.value" to name: "value" or use additional index property

    name: "value",
    index: "vits.value",
    jsonmap: "aptitudeArrayList.0.value"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Details: Only disable after user clicks the submit button, but before the posting back
Is it possible to get shutdown reason in Windows Server 2008 immediately after user
After a user adds 5 emails and their name to form below, and then
jQgrid row is edited using inline editing mode. Pressing Enter sends data to server
I'm using jqGrid with mvc 2 like this: jQuery(#extension_grid).jqGrid({ url: '/Extension/Report', datatype: json, direction:
After user places an order I have to send detailed email message containing order
In a Swing app a method should continue only after user enters a correct
After the user fills my backing bean with info through the forms, I want
After a user submits a form, how do you detect that the form has
I have a form that and after the user fills in this form, I

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.