Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/08/2013, 05:16
Avatar de ajuncosa
ajuncosa
 
Fecha de Ingreso: enero-2005
Mensajes: 8
Antigüedad: 19 años, 3 meses
Puntos: 0
Pregunta No me carga los datos de un subgrid


Hola, estoy algo desesperado, ya que no me está cargando los datos de un subgrid.
Para obtener los registros se llama a un web services que retorna una variable JQGridJsonResponse, pero cuando voy aignar los datos al subgrid no está haciendo nada.
Os adjunto el código del grid y del subgrid.

$("#dtgBilletesPromocion").jqGrid({
datatype:
function() {
$.ajax(
{
url: "WebServices",
data: "{'XXXXXXX'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "POST",
complete: function(jsondata, stat) {
if (stat == "success") {
var mygrid = $("#dtgBilletesPromocion")[0];
var myjsongrid = eval("(" + jsondata.responseText + ")").d;
mygrid.addJSONData(myjsongrid);
}
else {
ShowDialog(JSON.parse(jsondata.responseText).Messa ge, "Error");
}
}
})
}, //END AJAX
//height: 'auto',
mtype: 'GET',
colNames: ['', 'Código Billete'],
colModel:
[
{ display: '', name: 'IMG_RECHAZADO', width: 20, sortable: false, align: 'center' },
{ display: 'Código Billete', name: 'COD_BILLETE', width: 305, sortable: true, align: 'left' }
],
jsonReader: //Set the jsonReader to the JQGridJSonResponse squema to bind the data.
{
root: "Items",
page: "CurrentPage",
total: "PageCount",
records: "RecordCount",
repeatitems: true,
cell: "Row",
id: "ID"
},
fontsize: 11,

width: 'auto',
emptyrecords: 'No hay resultados',
caption: 'Búsqueda de billetes',
loadui: 'enable',
pager: '#pager',
rowNum: 500,
rowList: [500, 1000, 1500],
viewrecords: true, //Show the RecordCount in the pager.
sortname: 'COD_BILLETE',
sortorder: 'DESC',
height: 300,
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id;
subgrid_table_id = subgrid_id + "_t";
subGridID = subgrid_id;
jQuery("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table>");
jQuery("#" + subgrid_table_id).jqGrid({
datatype:
function() {
$.ajax(
{
url: "WEBSERVICES INFORMACIÓN SUBGRID",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "POST",
complete:
function(jsondata, stat) {
if (stat == "success") {
var mygrid = $("#" + subgrid_table_id)[0];
var myjsongrid = eval("(" + jsondata.responseText + ")").d;
mygrid.addJSONData(myjsongrid);
}
else {
ShowDialog(JSON.parse(jsondata.responseText).Messa ge, "Error");
}
}
})// END AJAX
}, // END FUNCTION
colNames: ['ID_LOG'],
colModel: [{ name: "ID_LOG", index: "ID_LOG", width: 80, key: true }],
height: '100%',
rowNum: 20,
sortname: 'num',
sortorder: "asc"
});
}
}).navGrid("#pager", { edit: false, add: false, search: false, del: false }); // END GRID