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

  • Home
  • SEARCH
  • 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 7638989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:18:24+00:00 2026-05-31T08:18:24+00:00

I have a jqGrid with a dropdown. I am filling the dropdown with custom

  • 0

I have a jqGrid with a dropdown. I am filling the dropdown with “custom formatter”(dropDownFormatter1) value.I am getting that, but as per the onchange i need to do some functionality. My main question is how to add the onchange event in my below code.

Here is my code:

$("#grid").jqGrid({
    url: bookingStatusurl,
    datatype: "json",
    shrinkToFit: true,
    colModel: [
        { name: 'BookingStatusID', index: ''BookingStatusID'', hidden: true,
            key: true },
        { name: 'BookingStatus', index: 'BookingStatus', width: 260,
            sortable: false },
        { name: 'NumberOfBooking ', index: 'NumberOfBooking', width: 300,
            sortable: false, align: 'right', formatter: 'currency',
            formatoptions: { prefix: "Number Of Booking: "} },
        { name: 'SortOrderType', index: 'SortOrderType', align: 'right',
            edittype: 'select', formatter: **dropDownFormatter1** }
        //As per the on change of my dropDownFormatter1 by subgrid need to change.
    ],
    rowNum: 40,
    rowList: [40, 80, 120]
    //sortname: 'id',
    viewrecords: true,
    //sortorder: "desc",
    autowidth: true,
    multiselect: false,
    shrinkToFit: true,
    height: 'auto',
    altRows: true,
    subGrid: true,
    //loadonce: false,
    //caption: "Pipeline By Booking Status",
    subGridRowExpanded: function (subgrid_id, row_id) {}
});

Here is the code for cutom formatter:

function dropDownFormatter1(cellvalue, options, rowObject, action) {
   // var statusTypeId = rowObject[0];
    return '<label>Sort Order:</label>' +
        '<select>' +
            '<option value="asc">asc</option>' +
            '<option value="desc">desc</option>' +
        '</select>';
}

Please help me out.

Thanks.

  • 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-31T08:18:25+00:00Added an answer on May 31, 2026 at 8:18 am

    The easiest way to implement onchange callback would be to add onchange attribute in the HTML code which generate your dropDownFormatter1 formatter. You can for example define on the global level your custom JavaScript function

    var myOnChangeFormatter1Callback = function (event) {
            var $select = $(this), $tr = $select.closest('tr.jqgrow');
    
            alert ("the select in the row with id=" + $tr.id +
                   " are changed to the option" + $select.val());
        };
    

    To call myOnChangeFormatter1Callback from the onchange one can modify dropDownFormatter1 to the following

    function dropDownFormatter1(cellvalue, options, rowObject, action) {
       // var statusTypeId = rowObject[0];
        return '<label>Sort Order:</label>' +
            '<select onchange="myOnChangeFormatter1Callback.call(this, arguments[0]);">' +
                '<option value="asc">asc</option>' +
                '<option value="desc">desc</option>' +
            '</select>';
    }
    

    Typically events will be called with event as the name of the first parameter (ad the only) parameter, but in some browsers one should use windows.event instead. So to be more compatible one should use event || windows.event or use just arguments[0] like I did.

    If you don’t like to define function with var myOnChangeFormatter1Callback = function (... and will use function myOnChangeFormatter1Callback (... you will be unable to forward this inside of the function at list in strict mode of JavaScript execution. In the case you should forward this as additional parameter and use "myOnChangeFormatter1Callback(this, arguments[0]);" instead of "myOnChangeFormatter1Callback.call(this, arguments[0]);". The prototype of myOnChangeFormatter1Callback should be changed from var myOnChangeFormatter1Callback = function (event) {...} to function myOnChangeFormatter1Callback (myObj, event) {...}.

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

Sidebar

Related Questions

I have a case where I need to update a jqgrid based on some
I have jqgrid and in that I have one custom navigation button to export
I have a jqGrid that is using the toolbar search with some text searches
I have a jqGrid that when I go into edit mode I need to
I have a jqGrid that has add/edit dialogs with a form that's longer than
I have a jqGrid that's working 100% except that it keeps displaying undefined in
I have a JQGrid plugin in my website, the table is loading OK, but
I have a jqGrid (pared-down example below) where I need rather complicated validation to
I have a jqgrid containing some data to filter. I'd like to define a
Experts, I have JQGrid with custom template column like Edit. the following screen display

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.