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

The Archive Base Latest Questions

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

I have JqGrid with RadioButton per each row like this. … { name: ‘select’,

  • 0

I have JqGrid with RadioButton per each row like this.

  ...
 { name: 'select', label: 'select', width: 50, formatter:radio}

and function for radio formatter:

function radio(value, options, rowObject){
   var radioHtml = '<input type="radio" value=' + value + ' name="radioid" />';
   return radioHtml;
}

when I try to select a singlerow from the jqgrid i.ee., radio button which is only selected using this function:

  $(function () {
   $("#<%=editButton.ClientID%>").click(function () {
       var ids = $("#table").jqGrid('getCol', 'select', true);
       alert(ids)
       for (var i = 0; i < ids.length; i++) {
           //alert(ids[i].id)
           if (ids[i].id != '') {
               var idx = $("#table").jqGrid('getCell', ids[i].id, 'select');
           }
          // alert(idx);
       }
   });
 });

Am getting all the rows available in the grid rather than single selected row.

The same function works well if formatter is checkbox but not for radio. Is there something missing?

UPDATE:

   colModel: [
                     { name: 'select', label: 'select', width: 50,
                         formatter: function radio(cellValue, option) {
                             return '<input type="radio" name="radio_' + option.gid +       '"  />';
                         } 
                     },
                     { name: 'code', label: 'Branch Code', width: 250 },
                     { name: 'name', label: 'Branch Name', width: 250 },
                     { name: 'status', label: 'Group Status', width: 250 },
                ],

Function Click Handler:

     $("#<%=editButton.ClientID%>").click(function () {
            alert('M');
            var $selRadio = $('input[name=radio_' + $table[0].id + ']:checked'), $tr;
            alert('I');
            if ($selRadio.length > 0) {
                $tr = $selRadio.closest('tr');
                if ($tr.length > 0) {
                    alert("The id of selected radio button is " + $tr.attr('id'));
                }
            } else {
                alert("The radio button is not selected");
            }
        });
  • 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-27T17:50:21+00:00Added an answer on May 27, 2026 at 5:50 pm

    It seems to me that your current code from $("#<%=editButton.ClientID%>").click is too complex. You can do what you need in more simple way.

    First of all I recommend you to use the name attribute of the <radio> button which is depend on the id of the grid (see the answer). It could be like the following

    formatter: function (cellValue, option) {
        return '<input type="radio" name="radio_' + option.gid + '"  />';
    }
    

    You can get the id of selected radio button with the following code

    $("#<%=editButton.ClientID%>").button().click(function () {
        var $selRadio = $('input[name=radio_' + $grid[0].id + ']:checked'), $tr;
        if ($selRadio.length > 0) {
            $tr = $selRadio.closest('tr');
            if ($tr.length > 0) {
                alert("The id of selected radio button is " + $tr.attr('id'));
            }
        } else {
            alert("The radio button is not selected");
        }
    });
    

    See the demo which demonstrate this:

    enter image description here

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

Sidebar

Related Questions

I have a jqGrid with which users will select records. A large number of
I have a couple of columns in jqGrid with edittype=select. How can I read
I have this mysql tables I want to display with jqgrid. The problem appears
I have a jqGrid on which clicking of a row should render a partial
I have a jqgrid showing 117 total records in 50 rows per page (rowNum
I have a jqGrid in my project and I would like to add custom
I have a jqgrid and use form editing on this grid. The issue I
Experts, I have JQGrid with custom template column like Edit. the following screen display
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(#startDate).Val(); jQuery(#sandgrid).jqGrid({
I have this jqGrid: $(#report).jqGrid( { url: '/py/db?coll=report', datatype: 'json', height: 250, colNames: ['ACN',

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.