<table id="jqGrid"></table>
<div id="jqGridPager"></div>
<script>
    findControl = function ()
    {
        strFormSerialize = $( 'form' ).serialize();
        relaodGrid( strFormSerialize );
    }
    
    relaodGrid = function( s_url_param )
    {
        jQuery( '#jqGrid' ).jqGrid( 'clearGridData' );
        jQuery( '#jqGrid' ).jqGrid( 'setGridParam', { url: '<?=buildUrl('user/compGrid','block=001')?>?' + s_url_param } );
        jQuery( '#jqGrid' ).trigger( 'reloadGrid' );
    }
</script>
<script>
    var jqGridContent = $( "#jqGrid" );
    jqGridContent.jqGrid
    (
        {
            url         : '<?=buildUrl('user/trabaGrid','block=001')?>',
            mtype       : "POST",
            datatype    : "json",
            colNames    : [ 'IdCompania', 'Usuario', 'Nombre Completo', "Correo" ],
            colModel    : 
                          [
                            { name: 'IdPersona',         width: 0, align: 'center', hidden: true, hidedlg: false, editrules : { required: true }, key: true },
                            { name: 'UsuarioLogin',      width: ($( window ).width())/10, align: 'center', editable: false, sortable: false },
                            { name: 'NombreConcatenado', width: ($( window ).width())/4,  align: 'left',   editable: false, sortable: false },
                            { name: 'Email',             width: ($( window ).width())/5,  align: 'left',   editable: false, sortable: false }
                          ],
			viewrecords : true,
			width       : $(window).width() - 5,
            sortable    : true,
            multiSort   : true,
            emptyrecords: "No se encontro registros",
            rowNum      : 15,
            rownumbers  : true, // show row numbers
            pager       : "#jqGridPager",
            ondblClickRow: function( rowId, param2, param3, param4 ) 
            {
                var s_Usuario        = param4.target.parentNode.children[2].innerHTML;
                var s_NombreCompleto = param4.target.parentNode.children[3].innerHTML;
                var s_Correo         = param4.target.parentNode.children[4].innerHTML;
                parent.asignarValoresTrab( rowId, s_Usuario, s_NombreCompleto, s_Correo );
            }
        }
    );
    $( "#jqGrid" ).jqGrid( 'bindKeys' );
    $(window).on
    ( 
        "resize", 
        function () 
        {
            var newWidth = $( "#jqGrid" ).closest( ".ui-jqgrid" ).parent().width() - 5;
            jqGridContent.jqGrid( "setGridWidth", newWidth, true);
        }
    );
</script>