如何在jqgrid中对齐中心搜索弹出窗口

时间:2014-02-18 07:25:45

标签: jquery css jqgrid

我在Search popup中对齐中心jqgrid时遇到问题。当我点击jqgrid中的搜索按钮时,搜索弹出窗口将显示在网格的开头。

$(document).ready(function(){
            //jqGrid
            $("#usersList").jqGrid({
                url:'<%=request.getContextPath() %>/getUsersList',
                datatype: "json",               
                colNames:['Edit','Primary Email','Active','First Name','Middle Name','LastName','Mobile Number'],
                colModel:[
                    {name:'userId',search:false,index:'userId',width:30,sortable: false},                       
                    {name:'email',index:'user.primaryEmail',width:150},
                    {name:'isActive',index:'user.isActive',width:80},
                    {name:'firstName',index:'firstName', width:100},
                    {name:'middleName',index:'middleName', width:100},
                    {name:'lastName',index:'lastName', width:100},
                    {name:'mobileNo',index:'user.mobileNo', width:100},
                    ],
                    rowNum:20,
                    rowList:[10,20,30,40,50],
                    rownumbers: true,  
                    pager: '#pagerDiv',
                    sortname: 'user.primaryEmail',  
                    viewrecords: true,  
                    sortorder: "asc",
                    autowidth:'true',
            });
            $('#gridContainer div:not(.ui-jqgrid-titlebar)').width("100%");
            $('.ui-jqgrid-bdiv').css('height', window.innerHeight * .65);
            $('#load_usersList').width("130");
            $("#usersList").jqGrid('navGrid','#pagerDiv',{edit:false,add:false,del:false},{},{},{}, {closeAfterSearch:true});
            $(".inline").colorbox({inline:true, width:"20%"});
        });

2 个答案:

答案 0 :(得分:2)

ui.jqgrid.css 文件中更新了.ui-jqdialog课程。

jqgrid搜索弹出窗口是通过在left: 30% !important; top: 40% !important;类中添加css属性.ui-jqdialog来对齐中心

.ui-jqdialog {
    display: none;
    width: 300px;
    position: absolute;
    padding: .2em;
    font-size: 11px;
    overflow: visible;
    left: 30% !important;
    top: 40% !important;
}

答案 1 :(得分:1)

$("#usersList").jqGrid('navGrid','#pagerDiv',
{edit:false,add:false,del:false}, // globals
{}, // edit options
{}, // add options
{}, // del options
{closeAfterSearch:true,beforeShowForm:test,onClose:test2}, // search options
{} // view options
);

test = function (){
$( "#editmodlist" ).position({my:"center",at: "center",of: "#gbox_usersList"});
}
test2 = function (){
$("#editmodlist").attr({style:"width: auto; height: auto; z-index: 950; overflow: hidden; top: 4px; left: 4px; display: block;"})
}