I have an index.cshtml that contains a JqGrid grid, which is filled with a controller method and works correctly. (invoke the method from the client and fill all its fields)
Then I have a function _editRow that is executed when a record of the grid is double-clicked and this function also calls an input that would only bring the details of this record, but it does not . Try many things, but the _editRow function never invokes the controller method. he does not even access the first line of him.
then I leave the methods and calls in question.
Index.csHTML
$(document).ready(InicialProductor);
$.jgrid.gridUnload("#tblJQGrid");//FUnciona Perfecto
function Inicial(filter) {
$("#tblJQGrid").jqGrid({
mtype: 'POST',
url: '/Productor/ListaInicial', //Llamada al metodo para llenar grilla
datatype: "json",
colNames: ['Col01', 'Col02', 'Col03', 'Col04', ],
colModel: [
{ name: 'Col01', index: 'Col01', width: 255, stype: 'text'},
{ name: 'Col02', index: 'Col02', width: 90, align: "center" },
{ name: 'Col03', index: 'Col03', width: 150, align: "center" },
{ name: 'Col04', index: 'Col04', width: 80, align: "center" },
],
emptyrecords: 'No existen movimientos vigentes!',
rowNum: 10000,
viewrecords: true,
sortorder: 'Desc',
caption: "Produccion",
scrollOffset: 0,
height: 'auto',
loadonce: true,
multiselect: false,
postData: {
desc: filter
},
loadComplete: function (data) {
var countRows = $("#tblJQGrid").getRowData().length;
if (countRows === 0) {
NoFaund();
}
},
ondblClickRow: function () {
detailRow();// esto se ejecutará al hacer doble click sobre un registro
}
});
Initial Method () // to fill in the grid
public ActionResult ListaInicial(string sidx, string sord, int page, int rows, string desc = "")
{
//algo de logica
var data = new
{
rows = from c in list
select new
{
cell = new string[]
{
c.Col01,
c.Col02,
c.Col03,
c.Col04
}
}
};
return Json(data);
}
Index.csHTML // here the problem starts
function detailRow() {
var idRow = $('#tblJQGrid').jqGrid('getGridParam', 'selrow');
//Obtengo el numero del campo 01 para ir a buscar el detalle
var data = $('#tblJQGrid'),
selRowId = data.jqGrid('getGridParam', 'selrow'),
celValue = data.jqGrid('getCell', selRowId, 'Col01');
$.MDmessage({
messageType: "popup",
name: "popup_detailRow",
btnok: true,
title: "Detalles de: " + celValue,
width: 50,
mtype: 'POST',
content: 'Url.Action("_DetailRowsPza")'?id=' +celValue
});
}
Method for detail
public ActionResult _DetailRowsPza(int id)
{
//algo de lógica por acá
var data = new
{
///otro por poco de lógica por acá también
};
return PartialView("_detail", data);
}