Note that there are some explanatory texts on larger screens.

plurals
  1. POJqgrid Master Detail don't send the appropriate info
    primarykey
    data
    text
    <p>I'm searching about my problem here and find some tips, but doesn't work anyway, my problem is this:</p> <p>In the jqgrid Javascrip, I send as setGridParam this: <code>{url:'myurl/myfunction/'+ id, page:1, datatype:"json"}</code> but, the Jgqgrid still doesn't sending to my controller the Id for make a selection of the details, It´s always null..... I tried everyting and the problem persist, please help me.</p> <p>Here's my Javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function() { jQuery("#list").jqGrid({ url: '/Master/GridData/', datatype: 'json', mtype: 'GET', colNames: ['Id', 'Descripción'], colModel: [ { name: 'Id', index: 'Id', width: 50 }, { name: 'Descripcion', index: 'Descripcion', width: 80, sortable: true, editable: true, edittype: "text", editoptions: { maxlength: "100"} } ], pager: jQuery('#pager'), autowidth: true, rowList: [5, 10, 20, 50], sortname: 'Id', sortorder: "asc", viewrecords: true, caption: '&lt;b&gt;Listado de Masters&lt;/b&gt;', onSelectRow: function(ids) { if (ids != null) { var data = $("#list").getRowData(ids); jQuery("#DetailList").setGridParam({ url: "/Master/DetailGridData/" + data.Id, page: 1, datatype: 'json' }) .setCaption("&lt;b&gt;Details of Master : " + data.Descripcion+"&lt;/b&gt;") .trigger('reloadGrid'); } } }).navGrid(pager, { edit: false, add: false, del: false, refresh: true, search: false }); jQuery("#DetailList").jqGrid ({ height: 100, datatype: "json", colNames: ['Id', 'Descripción', 'Modelo'], colModel: [ { name: 'Id', index: 'Id', width: 50 }, { name: 'Descripcion', index: 'Descripcion', width: 80, sortable: true, editable: true, edittype: "text", editoptions: { maxlength: "100"} }, { name: 'Modelo', index: 'Modelo', width: 80, sortable: true, editable: true, edittype: "text", editoptions: { maxlength: "100"} } ], rowNum: 5, rowList: [5, 10, 20], pager: jQuery('#DetailPager'), sortname: 'Id', viewrecords: true, sortorder: "desc" }).navGrid('#DetailPager', { add: false, edit: false, del: false, search: false }); }); &lt;/script&gt; </code></pre> <p>And here's my Controller Code:</p> <pre><code> public ActionResult GridData(string sidx, string sord, int? page, int? rows) { List&lt;Master&gt; ms = new List&lt;Master&gt;(); ms = MasterRepository.GetAll().ToList&lt;Master&gt;(); int pageIndex = Convert.ToInt32(page) - 1; int totalrecords = ms.Count(); int totalpages = (int)Math.Ceiling((decimal)totalrecords / (decimal)rows); var jsonData = new { sidx = "Id", sord = "asc", page = 1, records = 25, rows = ( from ch in ms select new { id = ch.Id, cell = new string[] { ch.Id.ToString(), ch.Descripcion, } }).ToArray(), }; return Json(jsonData, JsonRequestBehavior.AllowGet); } public ActionResult DetailGridData(string IdMaster, string sidx, string sord, int? page, int? rows) { int IdCh = Convert.ToInt32(IdMaster); IList&lt;Detail&gt; det = new List&lt;Detail&gt;(); det = DetailRepository.GetByMaster(IdCh).ToList&lt;Detail&gt;(); int pageIndex = Convert.ToInt32(page) - 1; int totalrecords = det.Count(); var jsonData = new { sidx = "Id", sord = "asc", page = 1, records = 25, rows = ( from bah in det select new { id = bah.Id, cell = new string[] { bah.Id.ToString(), bah.Descripcion, bah.Modelo } }).ToArray(), }; return Json(jsonData, JsonRequestBehavior.AllowGet); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload