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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:48:41+00:00 2026-06-13T01:48:41+00:00

I have a jqGrid where I am sending a string value to the colmodel

  • 0

I have a jqGrid where I am sending a string value to the colmodel for a particular property called “equipments“. Everything is ok so far as the value is showing perfectly on the grid.
I have also added an Add and Edit button and all is well and working fine, the forms are showing as expected. (Forgive the apparantly long post but its extremely easy to follow)

I modified field called equipments on the add form and injected my very own multiple select like this

colModel

            {name:'equipments',index:'equipments', width:6, editable:true, edittype:'custom',
              editoptions:{
                  custom_element:function(){                                  
                        return $('<div id="mytrensferselect"><div class="transfer"><select id="select1" multiple="multiple"></select><a href="#" id="addbutton">add</a></div><div class="transfer"><select id="select2" multiple="multiple"></select><a href="#" id="removebutton">remove</a></div></div>');  
                      },
                      custom_value:function(ele){
                                return ele.val();           
                      }                               
                  }                           
            }

Add Button – beforeShowForm option

                    bSubmit: "Save and New",
                    bCancel: "Cancel",
                    beforeShowForm: function(form) {
                            $.get('<c:url value="/moduleinstances/retrieveequipments?miId="/>' , function(data){  //load in my list of equipments as json string
                                var obj = jQuery.parseJSON(data);  //parse the resulting json in order to populate select1 and select2
                            $("#select1").html(obj.remaining);
                            $("#equipments").removeAttr("name").removeAttr("id").removeClass("customelement");
                            $("#select2").html(obj.owning).attr("name","equipments").attr("id","equipments").addClass("customelement");
                            $('#addbutton').click(function() {
                                return !$('#select1 option:selected').remove().appendTo('#equipments');
                            });
                            $('#removebutton').click(function() {
                                return !$('#equipments option:selected').remove().appendTo('#select1');
                            });
                            }); //End AJAX CALL abd CUSTOM Transfer Select logic

//Start Logic For Custom Save and Close Button

                        $('<a href="#">Save and Close<span class="ui-icon ui-icon-disk"></span></a>').click(function() {
                            if($.isNumeric($(form.selector+" #rateOfPay").val())){
                                $.post('<c:url value="/moduleinstances/create/${courseModule.id}"/>', $('#FrmGrid_list2').serialize() , function(data){
                                    $('#list2').trigger("reloadGrid");
                                    $("#cData").trigger('click');
                                }); 
                            }else{
                                    alert("Pay Rate must be numeric");
                            }                      
                        }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
                        .prependTo("#Act_Buttons>td.EditButton");
                        $('#title').attr('value','${courseModule.name}'); 
                        $("#leadLecturer").val( '${lecturer.id}' );
                    }

Here is the relevant part of my add form.

enter image description here

The functionality is working fine when I click on Save and New which is the submit button I decleared via bSubmit: "Save and New" above. The postdata for this is shown on your left. When I click on the Save and close button which is my custom button. The post data is shown on your right.

enter image description here

The Save and Close uses jquery to serialize the entire form like this $('#FrmGrid_list2').serialize(), this is where it gets hairy.

If we look at what was posted for equipments in both cases we can see the name difference. It seems like jqGrid is intelligent enough to figure out its an array of values, while jquery serialize() didn’t in the way i want it to. I am using Spring MVC 3.0 and here is where my equipments data goes to the action.

@RequestMapping(value = "update", method = RequestMethod.POST)
public @ResponseBody String update(Model uiModel,
        @RequestParam("id") Long mId,
        @RequestParam("campus") Long cId,
        @RequestParam("leadLecturer") Long lId,//This is actually a Person ID.
        @RequestParam("semesterStartDate") @org.springframework.format.annotation.DateTimeFormat(pattern = "MMMM dd, yyyy") java.util.Calendar semesterstartdate,
        @RequestParam("semesterEndDate") @org.springframework.format.annotation.DateTimeFormat(pattern = "MMMM dd, yyyy") java.util.Calendar semesterenddate,
        @RequestParam("tuitionStartDate") @org.springframework.format.annotation.DateTimeFormat(pattern = "MMMM dd, yyyy") java.util.Calendar tuitionstartdate,
        @RequestParam("tuitionEndDate") @org.springframework.format.annotation.DateTimeFormat(pattern = "MMMM dd, yyyy") java.util.Calendar tuitionenddate,
        @RequestParam("rateOfPay") Double rateOfPay,
        @RequestParam("equipments[]") ArrayList<String> equipments,
        HttpServletRequest httpServletRequest) { Bla...bla...bla }

Look at the very last @RequestParam, Spring is capable of handling the array of items, but when it gets posted with jQuery serialize, the action cannot find the paramiter called “equipments[]”
I saw a link here about this, can I simply do this instaed?

Any ideas

  • 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-06-13T01:48:43+00:00Added an answer on June 13, 2026 at 1:48 am

    Ok so for the benefit of others, what I did to solve the problem was manually serialize the form as a well formed json-string and send that string variable to the server. Something like

    //select each form element and get its value using jquery
        var customPostData = '({ sessionNumber: "'+$("#sessionNumber").val()+'", sessionDate: "'+$("#sessionDate").val()+'", starttime: "'+$("#starttime").val()+'", endtime: "'+$("#endtime").val()+'", sessionStatus: "'+$("#sessionStatus").val()+'", sessionType: "'+$("#sessionType").val()+'", topic: "'+$("#topic").val()+'", id: "'+myId+'", equipments:'+selectedequips.toSource()+'})';
        var submitdata = eval('(' + customPostData + ')'); //use parseJSON insted of eval
    
        $.post("my-url", submitdata , function(data){
           //use the returning information in the data variable
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jqgrid and after sending those grid records to server I want
I have a jqGrid loaded by AJAX inside a jQuery UI Dialog. Everything is
I have a jqGrid set up with local data. I'm not sending any data
I have a jqGrid in an ASP.Net MVC. The grid is defined as: $(#list).jqGrid({
I have used jqGrid Treeview Adjacency model to display the hierarchy. Treeview works perfectly
I have a JQGrid inside an accordion. When the grid has no posts it
We have a jqGrid that shows the search box above the grid at all
I have a jqGrid, and one column should have a default value when adding
I have jqGrid 3.5 (full) mostly working. I have it retrieving data with the
hi all i have jqgrid and set update inline . i wrote this code

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.