0

I have implemented JQgrid for one of my application. I have written below code

jQuery("#list").jqGrid({
     url: '@Url.Action("GridData", "Item")',
     datatype: 'json',
     mtype: 'POST',
     colNames: ['ItemId', 'Description'],
     colModel: [
     {
         name: 'ItemId', index: 'ItemId', align: 'center',
         sorttype: "int", hidden: true, key:true
     },
     {
         name: 'Description', index: 'Description', width: "250px" },
         pager: jQuery('#pager'),
         rowNum: 10,
         rowList: [5, 10, 20, 50],
         sortname: 'ItemId',
         sortorder: "asc", width: '750', height: 'auto',
         viewrecords: true,
         imgpath: ''
      });

Now, i want to retrieve row id. I am using below code to get row id

var grid = jQuery("#list");
var rowKey = grid.getGridParam("selrow");

But it is giving me wrong id. I want my rowid to be itemid. But it is giving me wrong row id.

I have also written "key:true" to overwrite row id, but it is not working.

Can anyone help?

Makudex
  • 1,042
  • 4
  • 15
  • 40
User5590
  • 1,383
  • 6
  • 26
  • 61
  • You might find this useful: http://stackoverflow.com/questions/4408284/jqgrid-locate-rowid-from-key-value – JGV Sep 14 '15 at 05:39
  • Tried that also, but still not working. – User5590 Sep 14 '15 at 06:00
  • First of all you should *always* write which fork of jqGrid ([free jqGrid](https://github.com/free-jqgrid/jqGrid), [Guriddo jqGrid JS](http://guriddo.net/?page_id=103334) or old jqGrid in version <=4.7) and which version you use. You use for example `imgpath` parameter which not more exist in very old jqGrid 3.5. You should additionally include the test JSON data returned from the server. It's better if you provides the demo (in jsfiddle for example) which reproduces the problem. – Oleg Sep 14 '15 at 06:52
  • Okay. Let me set up a demoin jsfiddle and will provide it to you – User5590 Sep 14 '15 at 08:12

0 Answers0