jqGrid的排垂直对齐没有中间 [英] jqGrid row vertical alignment not middle

查看:936
本文介绍了jqGrid的排垂直对齐没有中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关某种原因在我们的网格中的行的垂直对准不中间。这似乎是顶部。有什么具体的你要怎么做才能达到垂直对齐方式?

下面是对齐的例子:

我们的电网定义:

  $。延长(jQuery.jgrid.defaults,{
    网址:NoData.json,
    数据类型:JSON,
    MTYPE:GET,
    altRows:真正的,
    // altclass:zebraOdd,
    loadError:功能(XHR,ST,ERR){
        handleError的(XHR,错误加载网格);
    },
    onPaging:函数(二){
        返回的onpage($(本));
    },
    beforeRequest:函数(){
        beforeReq($(本));
    },
    loadComplete:函数(){
        loadComp($(本));
    },
    onSelectRow:功能(ID){
        $(本).resetSelection(); //这个prevents行悬停和altclass的禁用 -  http://stackoverflow.com/questions/3916477
    },
    scrollOffset:0,//没有滚动条
    的rowNum:15,
    shrinkToFit:真正的,
    宽度:1120,
    viewrecords:真正的,
    高度:360,
    hidegrid:假//不显示在右上角展开/折叠按钮
});

$(#格-POS)。jqGrid的({
    colNames:['持仓账户,产品code,产品类型,过期,看跌/看涨,行使价,当前长,电流短路,举行演习的请求','Held(挂起)放弃要求,最后交易日/到期日','选择操作'],
    colModel:
                   {名字:账户,索引:账户,宽度:85,排序:假},
                   {名字:产品code',索引:产品code',宽度:85,排序:假},
                   {名字:productType,索引:productType',宽度:85,排序:假},
                   {名称:'过期',索引:'到期',宽度:85,对齐:权,STYPE:选择,排序:假},
                   {名字:putCall,索引:putCall',宽度:85,排序:假},
                   {名字:罢工,索引:罢工,sorttype:浮动,对齐:权,宽度:85,排序:假},
                   {名:长,索引:长,宽度:85,对齐:权,排序:假},
                   {名字:'短',索引:'短',宽度:85,对齐:权,排序:假},
                   {名称:演习,索引:'运动',宽度:90,对齐:权,排序:假},
                   {名称:'放弃',索引:'放弃',宽度:90,对齐:权,排序:假},
                   {名称:'有限公司',索引:'有限公司',宽度:110,对齐:权,排序:假},
                   {指数:'操作',宽度:150,标题:假的,对齐:中心,格式:opsFormatter,排序:假}
               ]
               寻呼机:#DIV-POS-寻呼机,
               标题:视图位置
});
 

解决方案

我们已经在另一个分区的有垂直对齐我们的网格:顶部设置。删除这一点,我们是很好的。咄

For some reason on our grid the vertical alignment of the rows is not middle. It appears to be top. Is there something specific you have to do to achieve vertical alignment?

Here's an example of the alignment:

Our grid definitions:

$.extend(jQuery.jgrid.defaults, { 
    url:'NoData.json',
    datatype: 'json',
    mtype: 'GET',
    altRows:true, 
    //altclass:'zebraOdd',
    loadError: function(xhr,st,err) { 
        handleError(xhr, 'Error loading grid');
    },
    onPaging: function (b) {
        return onPage($(this));
    },
    beforeRequest: function() {
        beforeReq($(this));
    },
    loadComplete: function() {
        loadComp($(this));
    },
    onSelectRow: function(id){
        $(this).resetSelection(); //This prevents the disabling of the row hovering and altclass - http://stackoverflow.com/questions/3916477
    },
    scrollOffset:0, //No scrollbar
    rowNum:15,
    shrinkToFit:true,
    width:1120,
    viewrecords: true ,
    height: '360',
    hidegrid: false //Don't show the expand/collapse button on the top right
});  

$("#grid-pos").jqGrid({
    colNames:['Position Account', 'Product Code', 'Product Type','Expiry', 'Put/Call', 'Strike Price', 'Current Long', 'Current Short', 'Held Exercise Requests', 'Held Abandon Requests', 'Last Trade Date / Expiration Date', 'Select Operation'],
    colModel :[
                   {name:'account', index:'account', width:85, sortable:false},
                   {name:'productCode', index:'productCode', width:85, sortable:false},
                   {name:'productType', index:'productType', width:85, sortable:false},
                   {name:'expiry', index:'expiry', width:85, align:'right',stype:'select', sortable:false},
                   {name:'putCall', index:'putCall', width:85, sortable:false},
                   {name:'strike', index:'strike', sorttype: 'float', align:'right', width:85, sortable:false},
                   {name:'long', index:'long', width:85, align:'right', sortable:false},
                   {name:'short', index:'short', width:85, align:'right', sortable:false},  
                   {name:'exercise', index:'exercise', width:90, align:'right', sortable:false},
                   {name:'abandon', index:'abandon', width:90, align:'right', sortable:false},
                   {name:'LTD', index:'LTD', width:110, align:'right', sortable:false},
                   {index:'operations', width:150, title:false, align: 'center', formatter:opsFormatter, sortable:false}
               ],
               pager: '#div-pos-pager',
               caption: 'View Positions'
});  

解决方案

We had our grid within another div that had vertical-align:top set. Removed this and we were good. duh

这篇关于jqGrid的排垂直对齐没有中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆