title: Weird behavior of jqGrid row selection
body: <p>I have this very unusual behavior, Let me describe the problem.</p>
  
  <p>The jqgrid has 14 records all together, at first it is set to <code>rowNum:10,</code> when from the drop down I select to display 50 rows all the records accommodate, but in Firefox 5 when I select the <strong>11th row</strong> (Name as <strong>asd</strong>) it selects the 10th row as well. It behaves differently in IE8.</p>
  
  <p>In IE8 it gives me the below error</p>
  
  <pre><code>Webpage error details
  
  Message: 'className' is null or not an object
  Line: 2496
  Char: 4
  Code: 0
  URI: http://au1642163:10070/csm/view/include/js/jquery.jqGrid.min.js
  </code></pre>
  
  <p>Here is the image of IE8</p>
  
  <p><img src="https://i.stack.imgur.com/fb66s.png" alt="enter image description here"></p>
  
  <p>My jqgrid code</p>
  
  <pre><code>var xml=client.responseText;
           var xmlDoc = $.parseXML(xml); 
           var $xml = $(xml);
  
           xml=xml.replace(/&lt;productId&gt;1/g, "&lt;productId&gt;"+productMap['1']);
           xml=xml.replace(/&lt;productId&gt;2/g, "&lt;productId&gt;"+productMap['2']);
  $('#configDiv').empty();
              $('#configDiv').html(
                      '&lt;div id="configDetailsGrid" width="100%"&gt;' +
                      '&lt;table id="list1" width="100%"&gt;&lt;/table&gt;&lt;div id="gridpager"&gt;&lt;/div&gt;&lt;/div&gt;');
  
              var grid = jQuery("#list1");
              var iconAlert;
  
              getColumnIndexByName = function (grid, columnName) {
                  var cm = grid.jqGrid('getGridParam', 'colModel'), i = 0, l = cm.length;
                  for (; i &lt; l; i += 1) {
                      if (cm[i].name === columnName) {
                          return i; // return the index
                      }
                  }
                  return -1;
              },
              grid = jQuery("#list1"),
              iconAlert = '&lt;span class="ui-state-error" style="border:0"&gt;&lt;span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"&gt;&lt;/span&gt;&lt;/span&gt;';
  
  
  
              grid.jqGrid({
  
                datastr : xml,
                datatype: 'xmlstring',
                colNames:['cfgId','Name', 'Host','Operating System', 'Description','Product', 'Type', 'Last Updated Time','Last Updated By','',''],
                colModel:[
                    {name:'cfgId',index:'cfgId', width:90, align:"left", hidden:true},
                    //{name:'updateDate',index:'updateDate', width:12, align:'center', formatter: oldConfigurationWarning },
                    {name:'cfgName',index:'cfgName', width:70, align:"left", formatter: 'showlink', formatoptions: {baseLinkUrl: '#'} },
                    {name:'hostname',index:'hostname', width:70, align:"left"},
                    {name:'osname',index:'osname', width:90, align:"left"},
                    {name:'cfgDesc',index:'cfgDesc', width:90, align:"left"},
                    {name:'productId',index:'productId', width:40, align:"left"},
                    {name:'cfgType',index:'cfgType', width:50, align:"left"},
                    {name:'updateDate',index:'updateDate',sorttype:'Date', width:120, align:"left"},
                    {name:'emailAddress',index:'emailAddress', width:120, align:"left"},
                    {name:'absolutePath',index:'absolutePath', width:90, align:"left", hidden:true},
                    {name:'fileName',index:'fileName', width:90, align:"left", hidden:true}
  
                ],
                pager : '#gridpager',
                rowNum:10,
                rowList:[10,50,100],
                scrollOffset:0,
                height: 'auto',
                emptyrecords: 'No configurations loaded',
                autowidth:true,
                viewrecords: true,
                gridview: true,
                multiselect: true,
                xmlReader: {
                    root : "list",
                    row: "Response",
                    userdata: "userdata",
                    repeatitems: false
                },
                loadComplete: function () {
                      var count = grid.getGridParam();
                      var ts = grid[0];
                      if (ts.p.reccount === 0) {
                          grid.hide();
                          emptyMsgDiv.show();
                      } else {
                          grid.show();
                          emptyMsgDiv.hide();
                      }
  
                      //for showlink and icon alert having date difference more than 90 days
                      var iRow, row, trClasses, $cell,
                      icfgName = getColumnIndexByName(grid, 'cfgName'),
                      iupdateDate = getColumnIndexByName(grid, 'updateDate'),
  
                      mygrid = grid[0],
                      rows = mygrid.rows,
                      cRows = rows.length,
                      myLink = function (e) {
                          var $td = $(e.target).closest('td'),
                              text = $td.text(),
                              $tr = $td.closest('tr'),
                              rowid = $tr[0].id;
                              goToViewAllPage(rowid);
                      };
  
                  for (iRow = 0; iRow &lt; cRows; iRow += 1) {
                      row = rows[iRow]; // row.id is the rowid
                      trClasses = row.className.split(' ');
                      if ($.inArray('jqgrow', trClasses) &gt; 0) {
                          // the row is a standard row (only if subGrid:true are used)
  
                          /*if ($(row.cells[iupdateDate]).text() === 'Science') {
                             $cell.prepend(iconAlert);
                          }*/
                          var cellvalue1,firstDate,secondDate;
                          $cell = $(row.cells[icfgName]);
                          cellvalue1=$(row.cells[iupdateDate]).text();
                          firstDate = new Date();
                          //console.info(cellvalue1+", "+cellvalue1.length);
                          //var cellvalue1="08-18-2011 11:49:01";
                          if(cellvalue1.length&gt;25)
                          {
                              secondDate=new Date();
                              //secondDate = secondDate.substring(0, secondDate.length-3);
  
                              if(diffOf2Dates(firstDate,secondDate,true)&gt;=expireCondition)
                              {
                                  $cell.prepend(iconAlert);
                              }
                              $cell.click(myLink);
                          }
                          else
                          {
  
                              secondDate = cellvalue1.substring(0, cellvalue1.length-6);
                              if(diffOf2Dates(firstDate,secondDate,false)&gt;=expireCondition)
                              {
                                  $cell.prepend(iconAlert);
                              }
                              $cell.click(myLink);
                          }
  
  
  
                      }
                  }
                  },
                onSelectRow: function(id,status){
                    //var rowData = jQuery(this).getRowData(id); 
                    }
  
  
              });
              grid.jqGrid('navGrid','#gridpager',{edit:false,add:false,del:false});
              jQuery("#m1").click( function() {
                  var s;
                  s = grid.jqGrid('getGridParam','selarrrow');
                  alert(s);
              });
              var myGrid = $("#list1");
              $("#cb_"+myGrid[0].id).hide();
              // place div with empty message insde of bdiv
              emptyMsgDiv.insertAfter(grid.parent());
       }
  
  };
  </code></pre>
  
  <p>My XML response</p>
  
  <pre><code>&lt;list&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;704&lt;/cfgId&gt;
  &lt;cfgName&gt;IIR Windows1&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asda&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientIIR.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientIIR.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IIR&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 10:55:31.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-07 10:55:31.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;717&lt;/cfgId&gt;
  &lt;cfgName&gt;ilmwin&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asd&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientin164302.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientin164302.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IN164302&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 16:45:03.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-07 16:45:03.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;718&lt;/cfgId&gt;
  &lt;cfgName&gt;ilmwin1&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asdasd&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientin164302.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientin164302.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IN164302&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 16:46:35.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-08 10:19:26.0 IST&lt;/updateDate&gt;
  &lt;state&gt;2&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;723&lt;/cfgId&gt;
  &lt;cfgName&gt;ilm linux&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asd&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientestilo.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientestilo.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;estilo&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-08 14:20:09.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-08 14:20:09.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Linux&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;696&lt;/cfgId&gt;
  &lt;cfgName&gt;ILMwin1&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asfas&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientin164302.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientin164302.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;mkuamrln@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IN164302&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 16:15:06.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-06 16:15:06.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;697&lt;/cfgId&gt;
  &lt;cfgName&gt;ILMlin&lt;/cfgName&gt;
  &lt;cfgDesc&gt;dgds&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientestilo.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientestilo.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;mkuamrln@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;estilo&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 16:20:58.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-06 16:20:58.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Linux&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;706&lt;/cfgId&gt;
  &lt;cfgName&gt;ILM linux&lt;/cfgName&gt;
  &lt;cfgDesc&gt;wwrwrwr&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientestilo.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientestilo.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;mkuamrln@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;estilo&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 14:22:03.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-07 14:22:03.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Linux&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;698&lt;/cfgId&gt;
  &lt;cfgName&gt;test1&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asfta&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientgcslpar1.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientgcslpar1.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;gcslpar1&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 17:14:31.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-08 10:20:15.0 IST&lt;/updateDate&gt;
  &lt;state&gt;2&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;AIX&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;699&lt;/cfgId&gt;
  &lt;cfgName&gt;test2&lt;/cfgName&gt;
  &lt;cfgDesc&gt;adAD&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientgcslpar2.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientgcslpar2.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;mkuamrln@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;gcslpar2&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 17:14:46.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-06 17:14:46.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;AIX&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;702&lt;/cfgId&gt;
  &lt;cfgName&gt;IIR Windows&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asdad&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientIIR.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientIIR.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IIR&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 10:47:10.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-07 10:47:10.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;687&lt;/cfgId&gt;
  &lt;cfgName&gt;asd&lt;/cfgName&gt;
  &lt;cfgDesc&gt;a&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientestilo.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientestilo.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;estilo&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 13:28:28.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-06 13:28:28.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;Linux&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;688&lt;/cfgId&gt;
  &lt;cfgName&gt;asd1&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asd&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientbuckeye.ABC.com.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientbuckeye.ABC.com.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;buckeye.ABC.com&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-06 13:30:10.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-06 13:30:10.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;Linux&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;701&lt;/cfgId&gt;
  &lt;cfgName&gt;NULL&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asda&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientin164302.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientin164302.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;IN164302&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 10:43:19.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-08 16:44:00.0 IST&lt;/updateDate&gt;
  &lt;state&gt;2&lt;/state&gt;
  &lt;productId&gt;2&lt;/productId&gt;
  &lt;osname&gt;Windows_NT&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;Response&gt;
  &lt;cfgId&gt;705&lt;/cfgId&gt;
  &lt;cfgName&gt;Sunos config&lt;/cfgName&gt;
  &lt;cfgDesc&gt;asdasd&lt;/cfgDesc&gt;
  &lt;cfgType&gt;Production&lt;/cfgType&gt;
  &lt;fileName&gt;csmclientzenvo.xml&lt;/fileName&gt;
  &lt;absolutePath&gt;../webapps/csm/files//12345/csmclientzenvo.xml&lt;/absolutePath&gt;
  &lt;emailAddress&gt;asimon@ABC.com&lt;/emailAddress&gt;
  &lt;projectId&gt;12345&lt;/projectId&gt;
  &lt;hostname&gt;zenvo&lt;/hostname&gt;
  &lt;createDate&gt;2011-09-07 11:22:56.0 IST&lt;/createDate&gt;
  &lt;updateDate&gt;2011-09-07 11:22:56.0 IST&lt;/updateDate&gt;
  &lt;state&gt;1&lt;/state&gt;
  &lt;productId&gt;1&lt;/productId&gt;
  &lt;osname&gt;SunOS&lt;/osname&gt;
  &lt;/Response&gt;
  &lt;/list&gt;
  </code></pre>