jqgrid嵌套的子网格第二个子网格不显示

时间:2014-10-01 17:27:47

标签: jqgrid nested subgrid

我的第一个子网格显示了我的数据。 我尝试将第一个子网格显示在第一个...但子网格不显示...出了什么问题? 这是我的整个代码。我还没完呢。

$(document).ready(function(){


var dbbxll = $('#dbbxll');

function fixSearchOperators() {
var $grid = dbbxll,
    columns = $grid.jqGrid ('getGridParam', 'colModel'),
    filterToolbar = $($grid[0].grid.hDiv).find("tr.ui-search-toolbar");
    filterToolbar.find("th").each(function(index) {
    var $searchOper = $(this).find(".ui-search-oper");
    if (!(columns[index].searchoptions && columns[index].searchoptions.searchOperators)) {
        $searchOper.hide();
    }
});
}

//=============
//GRID SETUP


dbbxll.jqGrid({
    url: "db_bxll_jqgrid.php?q=2",
    editurl: "db_bxll_data.php",
    datatype: "xml",
    mtype: "GET",
    pager: "#pagerdbbxll",
    width: 1200,
    height: 300,
    rowNum: 20,
    rowList: [10, 20, 30],
    sortname: "id",
    sortorder: "asc",
    forceFit: true, 
    shrinkToFit:true, 
    viewrecords: true,
    gridview: true,
    autoencode: true,
    toppager: true,
    idPrefix: "m",
    caption: "DATA BASE",

    ondblClickRow: function(rowid) {
    jQuery(this).jqGrid('editGridRow', rowid,
                    {recreateForm:true,
                    //closeAfterEdit:true, 
                    width:900, 
                    editCaption: "EDITION",
                    bSubmit: "Editer",
                    closeOnEscape:true,
                    //reloadAfterSubmit:true,

                    beforeShowForm: function($form) {
                        //alert("!ATTENTION!\nN'oubliez pas de sauvegarder votre projet");

                        // EDIT & CLOSE
                        var mid = dbbxll.getGridParam('selrow');
                        $('<a href="#" title="Editer & Fermer">Editer & Fermer<span class="ui-icon ui-icon-disk"></span></a>')
                        .click(function() {
                        $('#sData').trigger('click');
                        $('#cData').trigger('click');
                        //alert("click!");
                        }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
                        .prependTo("#Act_Buttons>td.EditButton")
                        .insertBefore('#cData');

                        var gridIdEncoded = $.jgrid.jqID($form[0].id.substring(8));
                        $("#TblGrid_" + gridIdEncoded + "_2 #sData").attr('title','Editer (Ctrl+S)');
                        $("#editmod" + gridIdEncoded).keydown(function (e) {
                        if (e.ctrlKey && e.which === 83) { // 83 - 's'
                        $("#TblGrid_" + gridIdEncoded + "_2 #sData").trigger("click");
                        return false;
                        }
                        });

                        var mid = dbbxll.getGridParam('selrow');
                        $('<a href="#" title="Génère un document de gestion de projet et le joint dans la base de données">Générer<span class="ui-icon ui-icon-disk"></span></a>')
                        .click(function() {
                        window.location = 'Template.php?id=0'+mid;
                        //alert("click!");
                        }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
                        .prependTo("#Act_Buttons>td.EditButton")
                        .insertAfter('#cData');

                    }, // end beforeShowForm


                    afterSubmit: function (response) {
                    $("#dbbxll").trigger("reloadGrid", [{current:true}]);

                    var myInfo = '<div class="ui-state-highlight ui-corner-all">'+
                    '<span class="ui-icon ui-icon-info" ' +
                    'style="float: left; margin-right: .3em;"></span>' + '<span>Les modifications ont été éditées</span>' +
                    '</div>',
                    $infoTr = $("#TblGrid_" + $.jgrid.jqID(this.id) + ">tbody>tr.tinfo"),
                    $infoTd = $infoTr.children("td.topinfo");
                    $infoTd.html(myInfo);
                    $infoTr.show();


                    setTimeout(function () {
                    $infoTr.slideUp("slow");
                    }, 3000);

                    return [true, "", ""];
                    },                          
                    });
    }, //END DOUBLE CLICK - OPEN EDIT WINDOW

    //GROUPING
    grouping:false,
    groupingView : {
    groupField : ['pers_genre_id'],
    groupColumnShow : [true],
    groupText : ['<b>{0}</b>'],
    groupText : ['<b>{0} - {1} Item(s)</b>'],
    groupCollapse : true,
    groupOrder: ['asc']         
    },

    colNames: ["ID","DATE INSCR","DATE REACT","PROVENANCE","GENRE","NUM INSCR","NOM","PRENOM","DATE NAISS","NATIONALITE","NUM IDNATIONAL","NUM IBIS","ADRESSE","NUM ADRESSE","BTE","CP","VILLE","GSM","TEL","MAIL","TYPEPERMIS","PERMIS","TYPE PERMIS","ETUDE","LIEU ETUDE","DATE INOCC","INOCC","STATUT","CPRO","CPRO1","CPRO2","CPRO3"],
    colModel: [
        { name: "id", width: 55 },
        { name: "pers_date_inscription", width: 90, search:true, stype:'text',  
            formatter : 'date', 
            formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},
            editable:true,
            editoptions:{
                    //dataInit:datePick,
                    dataInit:function(elem){
                                    $(elem).datepicker({
                                    dateFormat:'dd-mm-yy',
                                    autoOpen: false,
                                    changeMonth: true,
                                    changeYear: true,
                                    showAnim: 'drop',
                                    })
                                    },                          
                    //size: 20,
                    defaultValue: function(){ 
                                    var currentTime = new Date(); 
                                    var month = parseInt(currentTime.getMonth() + 1); 
                                    month = month <= 9 ? "0"+month : month; 
                                    var day = currentTime.getDate(); 
                                    day = day <= 9 ? "0"+day : day; 
                                    var year = currentTime.getFullYear(); 
                                    return day+"-"+month + "-"+year; 
                                        } 
                    }// end edit option
        },
        { name: "pers_date_reactualisation", width: 80, align: "right", search:true, stype:'text',
            formatter : 'date', 
            formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},
            editable:true,
            editoptions:{
                    dataInit:function(elem){
                                    $(elem).datepicker({
                                    dateFormat:'dd-mm-yy',
                                    autoOpen: false,
                                    changeMonth: true,
                                    changeYear: true,
                                    showAnim: 'drop',
                                    })
                                    },                          
                    //size: 20,
                    defaultValue: function(){ 
                                    var currentTime = new Date(); 
                                    var month = parseInt(currentTime.getMonth() + 1); 
                                    month = month <= 9 ? "0"+month : month; 
                                    var day = currentTime.getDate(); 
                                    day = day <= 9 ? "0"+day : day; 
                                    var year = currentTime.getFullYear(); 
                                    return day+"-"+month + "-"+year; 
                                        } 
                    }// end edit option
        },
        { name: "pers_pro_id", width: 80, align: "right", search:true, stype:'text', 
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_provenance.php',
                    }// end edit option             },
        },
        { name: "pers_genre_id", width: 80, align: "right", search:true, stype:'text', 
            editable:true, 
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_genre.php',
                    }// end edit option
        },
        { name: "pers_num_inscription", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_nom", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_prenom", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_date_naissance", width: 80, align: "right", search:true, stype:'text',
            formatter : 'date', 
            formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},
            editable:true,
            editoptions:{
                    dataInit:function(elem){
                                    $(elem).datepicker({
                                    dateFormat:'dd-mm-yy',
                                    autoOpen: false,
                                    changeMonth: true,
                                    changeYear: true,
                                    showAnim: 'drop',
                                    })
                                    },                          
                    //size: 20,
                    defaultValue: function(){ 
                                    var currentTime = new Date(); 
                                    var month = parseInt(currentTime.getMonth() + 1); 
                                    month = month <= 9 ? "0"+month : month; 
                                    var day = currentTime.getDate(); 
                                    day = day <= 9 ? "0"+day : day; 
                                    var year = currentTime.getFullYear(); 
                                    return day+"-"+month + "-"+year; 
                                        } 
                    }// end edit option
        },
        { name: "pers_nationalite_id", width: 80, align: "right", search:true, stype:'text', 
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_nationalite.php',
                    }// end edit option
        },
        { name: "pers_num_idnational", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_num_ibis", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_adresse", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_num_adresse", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_bte", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_cp", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            editoptions: {
                    dataInit: function(elem) {
                                $(elem).autocomplete({
                                    source:'ddl/ddl_cpville.php',
                                    autoFocus: true,
                                    minLength:1
                                    });
                                    }
                                },// end edit options
        },
        { name: "pers_ville", width: 80, align: "right",search:true, stype:'text', editable:true },
        { name: "pers_gsm", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_tel", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_mail", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_permisconduiretype", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_permisconduire", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_permisconduire_id", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_permisconduire.php',
                    }// end edit option
        },
        { name: "pers_etude_id", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_etude.php',
                    }// end edit option
        },
        { name: "pers_lieuetude", width: 150, search:true, stype:'text', editable:true },
        { name: "pers_date_inoccupation", width: 80, align: "right", search:true, stype:'text',
            formatter : 'date', 
            formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},
            editable:true,
            editoptions:{
                    dataInit:function(elem){
                                    $(elem).datepicker({
                                    dateFormat:'dd-mm-yy',
                                    autoOpen: false,
                                    changeMonth: true,
                                    changeYear: true,
                                    showAnim: 'drop',
                                    })
                                    },                          
                    //size: 20,
                    defaultValue: function(){ 
                                    var currentTime = new Date(); 
                                    var month = parseInt(currentTime.getMonth() + 1); 
                                    month = month <= 9 ? "0"+month : month; 
                                    var day = currentTime.getDate(); 
                                    day = day <= 9 ? "0"+day : day; 
                                    var year = currentTime.getFullYear(); 
                                    return day+"-"+month + "-"+year; 
                                        } 
                    }// end edit option
        },
        { name: "pers_inoccupation_id", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_inoccupation.php',
                    }// end edit option
        },
        { name: "pers_statut_id", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_statut.php',
                    }// end edit option
        },
        { name: "pers_codepro_id", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_codepro1", width: 80, align: "right", search:true, stype:'text',
            editable:true,
            editoptions: {
                    dataInit: function(elem) {
                                $(elem).autocomplete({
                                    source:'ddl/ddl_codepro.php',
                                    autoFocus: true,
                                    minLength:1
                                    });
                                    }
                                },// end edit options
        },
        { name: "pers_codepro2", width: 80, align: "right", search:true, stype:'text', editable:true },
        { name: "pers_codepro3", width: 80, align: "right", search:true, stype:'text', editable:true }
    ], // end colModel principal grid


    subGrid : 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;
        var mainGridPrefix = $(this).jqGrid("getGridParam", "idPrefix");
        pureRowId = $.jgrid.stripPref(mainGridPrefix, row_id);

        console.log("sqt_id: "+row_id);
        console.log("sqt_id: "+subgrid_id);
        console.log("sqt_id: "+pureRowId);
        // Warning Duplicate IDs
                $('[id]').each(function(){
                var ids = $('[id='+this.id+']');
                if(ids.length>1 && ids[0]==this)
                console.warn('Multiple IDs #'+this.id);
                });

        $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");

        jQuery("#"+subgrid_table_id).jqGrid({
        hiddengrid:true,
        //height: '100%',
        width: 900,
        url:"entretien_subgrid.php?q=2&id="+pureRowId,
        datatype: "xml",
        mtype: 'GET',
        pager: '#entretienpagerdetail',
        rowNum:50,
        rowList:[5,10,20,30,40,50],
        //rownumbers: true,
        viewrecords: true,
        pager: pager_id,
        //idPrefix: "s_",
        idPrefix: "s" + row_id + "_",
        caption:"SUIVIS",
        colNames:['ENT_ID','CONSEILLER','ID','DATE ENTRETIEN','COMMENTAIRE','PROJET'],
        colModel:[

        {name:'ent_id', index:'ent_id', fixed:true, width:40, hidden:false, editrules: {edithidden: true} }, 
        {name:'cons_id', width:40, 
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_conseiller.php',
                    }// end edit option
        },
        {name:'id', index: 'id', width:40, hidden:false, editrules: {edithidden: true} },
        {name:'date_entretien', index:'date_entretien', width:40, editable:true, 
                    formatter : 'date', formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},         
                    editoptions:{
                        dataInit:function(elem)
                        {$(elem).datepicker({dateFormat:'dd-mm-yy'})},
                    defaultValue: function(){
                        var currentTime = new Date(); 
                        var month = parseInt(currentTime.getMonth() + 1); 
                        month = month <= 9 ? "0"+month : month; 
                        var day = currentTime.getDate(); 
                        day = day <= 9 ? "0"+day : day; 
                        var year = currentTime.getFullYear(); 
                        return day+"-"+month + "-"+year; 
                                            } 
                                } 
        },
        {name:'commentaire', width:40, editable:true },
        {name:'proj_id', width:40,
            editable:true,
            edittype:"select", 
            editoptions:{   
                    dataUrl:'ddl/ddl_projet.php',
                    }// end edit option
        },
        ],

        // SUBGRID ACTIONS NESTED INTO SUBGRID SUIVIS
        subGrid: true,
        subGridRowExpanded: function (subgrid_id2, row_id2) {
            var subgrid_table_id2, pager_id2;
            subgrid_table_id2 = subgrid_id2+"_t2";
            pager_id2 = "p2_"+subgrid_table_id2;

            //selRowId = $(this).jqGrid ('getGridParam', 'selrow'),
            celValue = $(this).jqGrid ('getCell', row_id2, 'ent_id');

            var mainGridPrefix = $(this).jqGrid("getGridParam", "idPrefix");
            pureRowId = $.jgrid.stripPref(mainGridPrefix, row_id2); 

            console.log("sqt_id: "+row_id2);
            console.log("sqt_id: "+subgrid_id2);
            console.log("sqt_id: "+pager_id2);
            //console.log("sqt_id: "+pureRowId);
            //console.log("sqt_id: "+selRowId);
            console.log("sqt_id: "+celValue);
            //console.log("sqt_id: "+rowdata);
            // Warning Duplicate IDs
                $('[id]').each(function(){
                var ids = $('[id='+this.id+']');
                if(ids.length>1 && ids[0]==this)
                console.warn('Multiple IDs #'+this.id);
                });

            $("#"+subgrid_id2).html("<table id=’"+subgrid_table_id2+"’ class=’scroll’></table><div id=’"+pager_id2+"’ class=’scroll’></div>");

            jQuery("#"+subgrid_table_id2).jqGrid({
            hiddengrid: false,
            //height: '100%',
            width: 900,
            url:"action_subgrid.php?q=3&ent_id="+celValue,
            datatype: "xml",
            mtype: 'GET',
            pager: '#actionpagerdetail',
            rowNum:50,
            rowList:[5,10,20,30,40,50],
            //rownumbers: true,
            viewrecords: true,
            pager: pager_id2,
            //idPrefix: "s_" + row_id + "_" + row_id2 + "_",
            caption:"ACTIONS",
            //ondblClickRow: function (rowid, iRow, iCol, e) {e.stopPropagation();},
            colNames:['ACT_ID','DATE ACTION','ACTION','COMMENTAIRE','ENT_ID'],
            colModel:[
            {name:'act_id', index:'act_id', fixed:true, width:40, hidden:true, editrules: {edithidden: true} }, 
            {name:'date_action', width:40, editable:true, 
                    formatter : 'date', 
                    formatoptions : {srcformat : 'Y-m-d', newformat : 'd-m-Y'},         
                    editoptions:{
                        dataInit:function(elem)
                        {$(elem).datepicker({dateFormat:'dd-mm-yy'})},
                    defaultValue: function(){
                        var currentTime = new Date(); 
                        var month = parseInt(currentTime.getMonth() + 1); 
                        month = month <= 9 ? "0"+month : month; 
                        var day = currentTime.getDate(); 
                        day = day <= 9 ? "0"+day : day; 
                        var year = currentTime.getFullYear(); 
                        return day+"-"+month + "-"+year; 
                                            }//end defaultvalue 
                                }//end editoption
            },
            {name:'cact_id', width:40,
            editable:true,
            editoptions: {
                    dataInit: function(elem) {
                                $(elem).autocomplete({
                                    source:'ddl/ddl_codeaction.php',
                                    autoFocus: true,
                                    minLength:1
                                    });
                                    }
                                },// end edit options
            },
            {name:'commentaire', width:40, editable:true },
            {name:'ent_id', index: 'ent_id', width:40, hidden:true, editrules: {edithidden: true} }
            ], //end colModel
            }); // END SUBGRID ACTION

            // ACTION NAVGRID
            jQuery("#"+subgrid_table_id2).jqGrid('navGrid',"#"+pager_id2,{edit:true,add:true,del:true});

            }, // end subgridrowexpanded subgrid action

        });// END SUBGRID SUIVIS - ENTRETIEN

        // SUIVIS - ENTRETIEN NAVGRID
        jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:true,add:true,del:true},
        {//prmEdit 
        //reloadAfterSubmit:false,
        closeAfterEdit:true,
        bSubmit: "Modifier",
        width:400,
        onclickSubmit: function(fordid) {
        var mygrid = $("#"+subgrid_table_id);
        var did = mygrid.jqGrid('getGridParam','selrow');
        var celdid = mygrid.jqGrid('getCell', did, 'ent_id');
            if (did != null) {
            jQuery("#"+subgrid_table_id).setGridParam({editurl:'entretien_updatedel.php?q=2&ent_id='+celdid});
            //alert(celdid);
                }
            else alert("Vous n'avez sélectionné aucun projet")
            },
        //refresh:true
        },//end edit
        {//prmAdd
        closeAfterAdd:true,
        bSubmit: "Sauvegarder",
        width:400,
        //reloadAfterSubmit:true,
        beforeShowForm: function(formid) {
        // we should get the id of the master here
        var mid = jQuery("#dbbxll").getGridParam('selrow');
        if (mid != null ) {
        // now we can set it in editurl
        jQuery("#"+subgrid_table_id).setGridParam({editurl:'entretien_add.php?q=2&id=0'+mid});
                            }
        else alert("Vous n'avez sélectionné aucun projet")
        }
        },//end add
        {//prmDel
        closeAfterDel:true,
        //reloadAfterSubmit:false,
        onclickSubmit: function(fordid) {
        var mygrid = $("#"+subgrid_table_id);
        var did = mygrid.jqGrid('getGridParam','selrow');
        var celdid = mygrid.jqGrid('getCell', did, 'ent_id');
            if (did != null) {
            jQuery("#"+subgrid_table_id).setGridParam({editurl:'entretien_updatedel.php?q=2&ent_id='+celdid});
            //alert(celdid);
            }
            else alert("Vous n'avez sélectionné aucun projet")
        },
        }//end del
        )//FIN NAV GRID SUIVIS - ENTRETIEN A INSERER;

    }//FIN SUBGRIDROWEXPANDED SUIVIS - ENTRETIEN

});// END MAIN GRID dbbxll

//=================================
//NAVIGATOR TO ADD EDIT SEARCH etc.

dbbxll.jqGrid('navGrid','#pagerdbbxll',
{edit:true,add:true,del:true,search:true,
cloneToTop: true,
addtext: '<span class="ui-pg-text">Add</span>',
edittext:'<span class="ui-pg-text">Edit</span>',
deltext: '<span class="ui-pg-text">Delete</span>',
searchtext: '<span class="ui-pg-text">Search</span>',
refreshtext: '<span class="ui-pg-text">Refresh</span>',
},

//{}, settings for edit {}, // settings for add {}, // settings for delete  

{//prmEdit
width:1000,
editCaption:'EDITION',
bSubmit: "Editer",
viewPagerButtons:false,

afterSubmit: function (response) {
    dbbxll.trigger("reloadGrid", [{current:true}]);
    var myInfo = '<div class="ui-state-highlight ui-corner-all">'+
             '<span class="ui-icon ui-icon-info" ' +
                 'style="float: left; margin-right: .3em;"></span>' + '<span>Les modifications ont été éditées</span>' +
             '</div>',
    $infoTr = $("#TblGrid_" + $.jgrid.jqID(this.id) + ">tbody>tr.tinfo"),
    $infoTd = $infoTr.children("td.topinfo");
    $infoTd.html(myInfo);
    $infoTr.show();

    // display status message to 3 sec only
    setTimeout(function () {
        $infoTr.slideUp("slow");
        }, 3000);
    return [true, "", ""]; // response should be interpreted as successful
    },// end aftersubmit    

beforeShowForm: function($form) {
    //alert("!ATTENTION!\nN'oubliez pas de sauvegarder vos modifications");

    // EDIT & CLOSE
    var mid = dbbxll.getGridParam('selrow');
    $('<a href="#" title="Editer & Fermer">Editer & Fermer<span class="ui-icon ui-icon-disk"></span></a>')
        .click(function() {
            $('#sData').trigger('click');
            $('#cData').trigger('click');
            //alert("click!");
        }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
          .prependTo("#Act_Buttons>td.EditButton")
          .insertBefore('#cData');

    // AUTORISE LE CONTROL-S POUR SAUVEGARDER LES DONNEES
    var gridIdEncoded = $.jgrid.jqID($form[0].id.substring(8));
                $("#TblGrid_" + gridIdEncoded + "_2 #sData").attr('title','Editer (Ctrl+S)');
                $("#editmod" + gridIdEncoded).keydown(function (e) {
                    if (e.ctrlKey && e.which === 83) { // 83 - 's'
                        $("#TblGrid_" + gridIdEncoded + "_2 #sData").trigger("click");
                        return false;
                    }
                });

    var mid = dbbxll.getGridParam('selrow');
    $('<a href="#" title="Génère un document de gestion de projet et le joint dans la base de données">Générer<span class="ui-icon ui-icon-disk"></span></a>')
        .click(function() {
            window.location = 'Template.php?id=0'+mid;
            //alert("click!");
        }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
          .prependTo("#Act_Buttons>td.EditButton")
          .insertAfter('#cData');                   
    }// end beforeShowForm

}, //END EDIT OPTION

{//prmAdd
width:1000,
addCaption:'AJOUTER UN NOUVELLE PERSONNE',
bSubmit: "Sauvegarder",
//beforeShowForm: setInterval(function(){alert("!ATTENTION!\nN'oubliez pas de sauvegarder votre projet")},600000),
//beforeShowForm: alert("!ATTENTION!\nN'oubliez pas de valider votre projet"),
closeAfterAdd:true,
//NE FONCTIONNE PAS -> afterShowForm
//afterShowForm: resizeSelectWidth,
// Empeche de fermer le formulaire si l'utilisateur clique en dehors de la zone formulaire (jqModal semble ne pas être nécessaire - bug sur Google Chrome & Safari)
modal:true,
jqModal:true,
},
{},{});

// END NAVIGATOR TO ADD EDIT SEARCH etc.

//===========
//RESIZE GRID
//$("#dbbxll").jqGrid('gridResize',{minWidth:350,maxWidth:900,minHeight:350, maxHeight:900});

//===============
//CHANGE TOPPAGER   
var topPagerDiv = $("#dbbxll_toppager")[0];
//$("#edit_dbbxll_top", topPagerDiv).remove();
//$("#del_dbbxll_top", topPagerDiv).remove();
$("#search_dbbxll_top", topPagerDiv).remove();
//$("#refresh_dbbxll_top", topPagerDiv).remove();
$("#dbbxll_toppager_center", topPagerDiv).remove();
$(".ui-paging-info", topPagerDiv).remove();

//==================
//CHANGE BOTTOMPAGER
var bottomPagerDiv = $("div#pagerdbbxll")[0];
$("#add_dbbxll", bottomPagerDiv).remove();
$("#edit_dbbxll", bottomPagerDiv).remove();
$("#del_dbbxll", bottomPagerDiv).remove();
$("#refresh_dbbxll", bottomPagerDiv).remove();

//=============
//FILTERTOOLBAR
var filters = dbbxll.jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, searchOperators: true}, {autosearch: true});
fixSearchOperators();

//===============
//NAVBUTTON SETUP
dbbxll.jqGrid('navButtonAdd', '#pagerdbbxll',
            {
                caption: '<span class="ui-pg-text"></span>',
                title: "Searching Toolbar",
                buttonicon: 'ui-icon-pin-s',
                //Open or Close SearchToolbar by click
                onClickButton: function () {
                    dbbxll[0].toggleToolbar();
                }
            }
        );

//Search Toolbar open. Close it thanks line bellow
//dbbxll[0].toggleToolbar();

//===============
//SEARCH FORM SETUP
$.extend($.jgrid.search, {
            multipleSearch: true,
            multipleGroup: true,
            caption: "RECHERCHER DANS LA DB",
            recreateFilter: true,
            closeOnEscape: true,
            closeAfterSearch: false,
            //overlay: 0
        });

});

我的子网格“SUIVIS”但是其他子网格“ACTIONS”没有显示。 第一个子网格SUIVIS的rowid给我1,它似乎是rownumber! 这就是我尝试celValue = $(this).jqGrid ('getCell', row_id2, 'ent_id');获取ID的原因。

consol log的结果

sqt_id:m250 sqt_id:dbbxll_m250 sqt_id:250 获取entretien_subgrid.php?q = 2&amp; id = 250&amp; _search = false&amp; nd = 1412190283435&amp; rows = 50&amp; page = 1&amp; sidx =&amp; sord = asc 200好的 45ms
sqt_id:sm250_1 sqt_id:dbbxll_m250_t_sm250_1 sqt_id:p2_dbbxll_m250_t_sm250_1_t2 sqt_id:39 多个ID #jqg_alrt

再次感谢

0 个答案:

没有答案