如何在jqgrid / subGrid 3级别的第三级中读取文件?我可以读取第一级和第二级的行,但是我不知道如何读取第三级的行。问候。
我只需要阅读第三级网格。
how do I read these rows.please see the image
jQuery("#jqGrid").jqGrid({
url:'Operaciones_Grilla.php?Op=700',
datatype: "json",
mtype: 'GET',
height: 400,
width: 1100,
colNames:['id','Sistema','Opciones_Sistema'],
colModel:[
{name:'id',index:'id', width:10,editable: false},
{name:'Sistema',index:'Sistema', width: 30, align: 'left',editable: true,editrules:{required:true},edittype:"select",editoptions:{dataUrl:'Operaciones_Grilla.php?Op=91',datatype: 'json',mtype: 'GET'}},
{name:'Opciones_Sistema',index:'Opciones_Sistema', width:55,editable: true,editrules:{required:true}}
],
cmTemplate: { editable: true,sortable: false },
rowNum:8,
rowList:[8,10,20,30],
pager: '#jqGridPager',
sortname: 'id',
loadonce: true,
viewrecords: true,
multiselect: false,
editurl: 'Operaciones_Grilla.php', // this is dummy existing url caption:"CRUD on Local Data"
footerrow: true,
userDataOnFooter : true,
autoencode:true,
caption: "Opciones de Sistema",
cellEdit: false,
hiddengrid: false,
ignoreCase: true,
subGrid: true,
subGridOptions: { "plusicon" : "ui-icon-triangle-1-e",
"minusicon" :"ui-icon-triangle-1-s",
"openicon" : "ui-icon-arrowreturn-1-e",
"reloadOnExpand" : false,
"selectOnExpand" : true },
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+"_t";
pager_id = "p_"+subgrid_table_id;
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id).jqGrid({
//url:"Operaciones_Grilla.php?Op=80&Filtro="+row_id,
url:"Operaciones_Grilla.php?Op=700",
datatype: "json",
height: 150,
width: 800,
colNames: ['id','Opciones_Sistema','Menu'],
colModel: [
{name:"id",index:"id",width:10,key:true,editable: false},
{name:"Opciones_Sistema",index:"Opciones_Sistema",width:30,editable: false, hidden:true},
{name:"Menu",index:"Menu",width:30,editable: true,editrules:{required:true}}
],
rowNum:20,
pager: pager_id,
height: '100%',
editurl: 'Operaciones_Grilla.php', // this is dummy existing url caption:"CRUD on Local Data"
footerrow: true,
userDataOnFooter : true,
autoencode:true,
/***************************************/
Here third level grid.
How do I read these rows ??????????
/***************************************/
subGrid: true,
subGridOptions: { "plusicon" : "ui-icon-triangle-1-e",
"minusicon" :"ui-icon-triangle-1-s",
"openicon" : "ui-icon-arrowreturn-1-e",
"reloadOnExpand" : false,
"selectOnExpand" : true },
caption: "Detalle de Opciones de Sistema",
subGridRowExpanded: function(subgrid_id2, row_id2) {
var subgrid_table_id2, pager_id2;
subgrid_table_id2 = subgrid_id2+"_t";
pager_id2 = "p_"+subgrid_table_id2;
$("#"+subgrid_id2).html("<table id='"+subgrid_table_id2+"' class='scroll'></table><div id='"+pager_id2+"' class='scroll'></div>");
jQuery("#"+subgrid_table_id2).jqGrid({
//url:"Operaciones_Grilla.php?Op=90&Filtro="+row_id2,
url:"Operaciones_Grilla.php?Op=700",
datatype: "json",
height: 150,
width: 800,
caption: "Detalle de Opciones del Menu",
colNames: ['id','Menu','Opciones_Menu'],
colModel: [
{name:"id",index:"id",width:10,key:true,editable: false},
{name:"Opciones_Menu",index:"Opciones_Menu",width:30,editable: false, hidden:true},
{name:"Menu",index:"Menu",width:30,editable: true,editrules:{required:true}}
],
rowNum:20,
pager: pager_id2,
height: '100%',
editurl: 'Operaciones_Grilla.php', // this is dummy existing url caption:"CRUD on Local Data"
footerrow: true,
userDataOnFooter : true,
autoencode:true
});
最佳答案
$("#bedata").click(function() {
var grid = $('#jqGrid')[0], rows = grid.rows,cRows = rows.length, iRow, row, trClasses,xx=0;
for (iRow = 0; iRow < cRows; iRow++) {
row = rows[iRow]; // row.id is the rowid
trClasses = row.className.split(' ');
if ($(row).hasClass("jqgrow") > 0)
{
sub_grilla="";
sub_grilla='jqGrid_'+row.id+'_t_';
} else if ($(row).hasClass("ui-subgrid")) {
var subgridTable = $(row).find("table.ui-jqgrid-btable:first");
var ret = jQuery(subgridTable).jqGrid('getGridParam',0);
var registros =jQuery(subgridTable).jqGrid('getGridParam', 'records');
var rows1 = jQuery(subgridTable).getDataIDs();
for (var i = 0; i < rows1.length; i++)
{
var rowId = rows1[i];
var rdata = jQuery("#"+sub_grilla+rows1[i]+"_t").jqGrid('getGridParam',0);
var registros2 =jQuery("#"+sub_grilla+rows1[i]+"_t").jqGrid('getGridParam', 'records');
var rows2 = jQuery("#"+sub_grilla+rows1[i]+"_t").getDataIDs();
for (var z = 0; z < rows2.length; z++)
{
var rowData3 = $("#"+sub_grilla+rows1[i]+"_t").jqGrid('getRowData', rows2[z]);
console.log(rowData3);
}// end for
}// end for
}// cierrra if
}//cierra el for
}); // cierra el boton