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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:37:06+00:00 2026-05-29T10:37:06+00:00

jQuery.extend( jQuery.jgrid.edit, { ajaxEditOptions: { contentType: application/json }, //form editor reloadAfterSubmit: true // afterSubmit:

  • 0
 jQuery.extend(
jQuery.jgrid.edit, {
    ajaxEditOptions: { contentType: "application/json" }, //form editor
    reloadAfterSubmit: true
//        afterSubmit: function (response, postdata) {
//    return [true, "", $.parseJSON(response.responseText).d];
//}
});

$.extend($.jgrid.defaults, {
    datatype: 'json',
    ajaxGridOptions: { contentType: "application/json" },
    ajaxRowOptions: { contentType: "application/json", type: "POST" },
               //row              inline     editing
    serializeGridData: function(postData) { return JSON.stringify(postData); },
    jsonReader: {
        repeatitems: false,
        id: "0",
        cell: "",
        root: function(obj) { return obj.d.rows; },
        page: function(obj) { return obj.d.page; },
        total: function(obj) { return obj.d.total; },
        records: function(obj) { return obj.d.records; }
    }

});


 $("#grantlist").jqGrid({
            url: 'webservice.asmx/GetGrant',
            colNames: ['ID', 'Name', 'Title'],
            colModel: [
            { name: 'ID', width: 60, sortable: false },
            { name: 'name', width: 210, editable: true },
            { name: 'title', width: 210, editable: true }
            ],
            serializeRowData: function(data) {
                var params = new Object();
                params.ID = 0;
                params.name = data.name;
                params.title = data.title;
                return JSON.stringify({ 'passformvalue': params, 'oper': data.oper, 'id': data.id });
            },
            mtype: "POST",
            sortname: 'ID',
            rowNum: 4,
            height: 80,
            pager: '#pager',
            editurl: "webservice.asmx/ModifyGrant"
        });
        $("#grantlist").jqGrid('navGrid', '#pager', { add: false, edit: false, del: false, refresh: false, search: false });
        $("#grantlist").jqGrid('inlineNav', '#pager');

//this is my server code
[WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public JQGrid<GrantComittee> GetGrantComittee(int? page, int? rows, string sidx, string sord, bool _search)
    {
        JQGrid<GrantComittee> jqgrid = new JQGrid<GrantComittee>();

        List<GrantComittee> data = GetGComittee();
        jqgrid.records = data.Count; //total row count
        jqgrid.total = (int)Math.Ceiling((double)data.Count / (double)rows); //number of pages
        jqgrid.page = page.Value;

        //paging
        data = data.Skip(page.Value * rows.Value - rows.Value).Take(rows.Value).ToList();
        foreach(GrantComittee i in data)
            jqgrid.rows.Add(i);


        return jqgrid;


    }

[WebMethod(EnableSession = true), ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public int ModifyGrantComittee(GrantComittee passformvalue, string oper, string id)
    {
        if (String.Compare(id, "_empty", StringComparison.Ordinal) == 0 ||
            String.Compare(oper, "add", StringComparison.Ordinal) == 0)
        {

            GrantComittee data = new GrantComittee();
            List<GrantComittee> set = new List<GrantComittee>();
            set = (List<GrantComittee>)Session["grantcomittee"];
            data = passformvalue;
            data.ID = set.Max(p => p.ID) + 1;
            set.Add(data);
            Session["grantcomittee"] = set;
            return data.ID; 
        }
        else if (String.Compare(oper, "edit", StringComparison.Ordinal) == 0)
        {
            // TODO: modify the data identified by the id
            return 0;
        }
        else if (String.Compare(oper, "del", StringComparison.Ordinal) == 0)
        {
            // TODO: delete the data identified by the id 
            return 0;
        }
        return 0;
    } 

I am using JqGrid to retrieve and add new records to database. So far i have been able to retrieve and add new items to the DB, I am using “json”. I do get in the response {“d”: “5”} for the id of the newly created row in the DB. However the new id does not display in the grid.
How can I update that value to new added row?

  • 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-29T10:37:07+00:00Added an answer on May 29, 2026 at 10:37 am

    I am using ‘inlinNav’ and after adding a new row i was not getting the grid to reload. The solution I found was to add parametes to the ‘inlineNav’ declaration. So I end up with the code i am providing as reference:

    $("#grantlist").jqGrid('inlineNav', '#pager', { addParams: { position: "last", addRowParams: {
                "keys": true, "aftersavefunc": function() { var grid = $("#grantlist"); reloadgrid(grid); }
            }
            }, editParams: { "aftersavefunc": function() { var grid = $("#grantlist"); reloadgrid(grid); } }
            });    
    function reloadgrid(grid) {
    grid.trigger("reloadGrid");
    

    }

    I was using more than one grid that is why i pass a grid parameter to the reload function.

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

Sidebar

Related Questions

I'm trying to merge array of JSON objects to one object using jQuery.extend function.
The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first
I have developed below plug-in (function($) { $.fn.addressSearch = function(settings) { settings = jQuery.extend({
i am using textarea elastic plugin JQuery. this is the plugin (function(jQuery){ jQuery.fn.extend({ elastic:
var RootComponent = { init: function(options){ options = jQuery.extend({name: 'Root'}, options); this.run('ContainerComponent.init')(options); } }
jQuery.fn.daterangepicker = function(settings){ var rangeInput = jQuery(this); //defaults var options = jQuery.extend({ ........ //function
(function($) { $.fn.myFoo= function (o){ this.element = $(this) options = jQuery.extend({ name: defaultName, size:
Given: jQuery.extend({ fooBar: function(){ return 'baz'; } }); does it modify the base jQuery
I know that jQuery.extend can be used to add by own custom methods to
OK I think I get Difference between jQuery.extend and jQuery.fn.extend? in that the general

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.