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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:52:13+00:00 2026-05-23T19:52:13+00:00

When i tried to check the check box in jQgrid it selecting the values

  • 0

When i tried to check the check box in jQgrid it selecting the values that’s fine ,and in that i have the custom formatter text field with out entering the values in text field and tried to select the check box i will display the alert message after that i will uncheck the checkbox but the focus is not get removed from the grid.

I have attached the screen shot please let me know the answer.

code is pasted here:

    jQuery("#list1").jqGrid({               

        url:actionurl,
        mtype: 'POST',          
        colNames:['PartnerId', 'Employee No','Employee Name' ,'Position', 'Position Id', 'Wages','Relieve Date','Days Required'],
        colModel:[                    
                      {name:'partnerId',index:'partnerId', width:280,sortable:true,search:false, hidden: true},
                      {name:'em_ka003_employeeno',index:'em_ka003_employeeno', width:200,sortable:true},
                      {name:'empname',index:'empname', width:280,sortable:false,search:false},
                      {name:'position',index:'position', width:250,sortable:false,search:false},
                      {name:'positionId',index:'positionId', width:0,sortable:false,search:false,hidden:true},                    
                      {name:'wages',index:'wages', width:100,sortable:false,search:false},                        
                      {name:'emp_relievedate',index:'emp_relievedate', width:200,sortable:false,search:false},
                      {name:'daysrequired',index:'daysrequired', width:140,sortable:false,search:false,formatter:createText},
                ],

        rowNum:10,
        rowList:[5,10,15],
        pager: '#pager1',         
        sortorder: "asc",
        sortname: 'em_ka003_employeeno', 
        viewrecords: true,
        rownumbers: true,
        loadonce: false,
        forceFit: true,
        datatype: 'xml',
        multiselect: true , 
        footerrow:true,
        userDataOnFooter:true,
        onSelectRow: function(rowId)
            { 
                handleSelectedRow(rowId); 
            },
        caption: "<b>Labor Extension",
        gridComplete: function() {          

            $.unblockUI();
        }



});

This is my custom formatter function:

function createText(el, cellval, opts)
    {
         return "<span><input class='dojoValidateValid required TextBox_OneCell_width number' type='text' id='days_req"+cellval.rowId+"' name='days_req"+cellval.rowId+"'  onKeyPress='return checkIt(event,false)'/></span>";

    }

function handleSelectedRow(id) 
{

var jqgcell     = jQuery('#list1').getCell(id, 'partnerId');
var daysrequired = jQuery("#days_req"+id+"").val();
var cbIsChecked = (jQuery("#jqg_list1_"+jqgcell).attr('checked'));

if(cbIsChecked==true)
 {

    /* Append the Days Required */


if(daysrequired=="")
    {

        alert("please enter the extension days");
        jQuery("#days_req"+id+"").focus();
        jQuery("#jqg_list1_"+jqgcell).attr('checked', false);
          jQuery('#list1').restoreRow(id);

        return false;
    }



 }

In first screen shot if the user if selecting the check box without entering the value in textbox it shows alert.In second screen shot the focus is not get removed.

  • 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-23T19:52:13+00:00Added an answer on May 23, 2026 at 7:52 pm

    I got the answer.

    If the text field value is zero while selecting the particular row in jqgrid at that time validate that with javascript and uncheck the selected row from the grid.

    Here is the working code i pasted below:

    if(daysrequired=="0")
        {
            myGrid.jqGrid('resetSelection');
        }
    
    • myGrid is my grid id.
    • resetSelection is a method in the jQGrid to unselect the selected rows.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a check box that fires a command using WPF/MVVM this works
I have a grid view that has a check box column, and I want
I want mt view to have the check box checked by default, I tried
Please check my website out: http://www.budgie.richardcmpage.com/index.php I've tried all sorts and can't get the
I was trying to check out a project from SVN using Eclipse. I tried
Greetings, I have asp.net check box control and asp.net dropdownlist control inside div tag.
jqGrid contains action formatter and boolean posted columns. I tried to hide Delete action
I have a jqGrid in my project and I would like to add custom
I have tried this several different ways but can't seem to figure out how
Situation: I have a check box and a div container inside another div container.

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.