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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:32:15+00:00 2026-05-15T01:32:15+00:00

I am trying to add a custom button to a JqGrid that implements a

  • 0

I am trying to add a custom button to a JqGrid that implements a ‘Check Out’ process.
Basically, every row has a ‘Check Out’ button that if clicked should be able to send a post back to the server and update a shopping cart and then change the button text to ‘Undo Check Out’.
So far I have:

colNames: ['Id', ... , 'Action' ],
colModel: [
{ name: 'Id', sortable: false, width: 1, hidden: true},
...
{ name: 'action', index: 'action', width: 75, sortable: false }
],
...
gridComplete: function() {
            var ids = jQuery("#east-grid").jqGrid('getDataIDs');
            for (var i = 0; i < ids.length; i++) {
                var cl = ids[i];
                checkout = "<input style='height:22px;width:75px;' type='button' value='Check Out' onclick=\" ??? \"  />";
                jQuery("#east-grid").jqGrid('setRowData', ids[i], { action: checkout });
            }
        },
...

Where ‘???’ is the part I need to solve.

Thank you in advance for your help.

  • 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-15T01:32:16+00:00Added an answer on May 15, 2026 at 1:32 am

    It seem to me that you have already a global JavaScript function like MyCheckOut and call it inside of ‘???’ area. If you add to this function an additional parameter like rowId then you can simply so overwrite the contain of you <input> button of the ‘action’, that it will point to new MyCheckIn function and have corresponding text in the value attribute. Your code will looks like following:

    MyCheckOut = function (gridId,rowId) {
        // do Check Out
        // ...
        // replace "Check Out" button to "Check In"
        var checkIn = "<input style='height:22px;width:75px;' type='button' " + 
                   "value='Check In' " +
                   "onclick=\"MyCheckIn(jQuery('" + gridId + "')," +
                   rowId + "); \"  />";
        jQuery(gridId).jqGrid('setRowData', rowId, { action: checkIn });
    };
    
    MyCheckIn = function (grid,rowId) {
        // do Check In
        // ..
        // replace "Check In" button to "Check Out" like in MyCheckOut 
    };
    
    jQuery("#east-grid").jqGrid({
        // ...
        colNames: ['Id', ... , 'Action' ],
        colModel: [
            { name: 'Id', sortable: false, width: 1, hidden: true},
            // ...
            { name: 'action', index: 'action', width: 75, sortable: false }
        ],
        // ...
        gridComplete: function() {
            var grid = jQuery("#east-grid");
            var ids = grid.jqGrid('getDataIDs');
            for (var i = 0; i < ids.length; i++) {
                var rowId = ids[i];
                var checkOut = "<input style='height:22px;width:75px;' " +
                               "type='button' value='Check Out' " +
                               "onclick=\"MyCheckOut('#east-grid'," +
                               rowId + ");\" />";
                grid.jqGrid('setRowData', rowId, { action: checkOut });
            }
        },
        // ...
    });
    

    If you have as a rowIdnot an integer, then you should place ' from the both side from rowId.

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

Sidebar

Related Questions

I'm trying to add a custom button to the button panel of jQuery's datepicker.
I am trying to add some custom build steps to my headless build process
I am trying to add a custom property to a base form that can
I'm trying to add a custom button to the Main-ribbon of a custom entity!
I am stumped trying to add a localized label to a custom button. I
I am trying to add a custom button in the new Xcode 4 Interface
I am trying to add an info button to my app to provide custom
I'm trying to add a custom printing button (like print invoice) on the Sales
I am trying to add custom icons to a Shared Add-in for Microsoft Word.
I'm creating a custom WP theme and trying to add custom menus to the

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.