代码之家  ›  专栏  ›  技术社区  ›  Marcus Leon

jqGrid行垂直对齐不在中间

  •  1
  • Marcus Leon  · 技术社区  · 14 年前

    下面是对齐的示例: alt text

    我们的网格定义:

    $.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'
    });  
    
    4 回复  |  直到 14 年前
        1
  •  5
  •   Adrian    14 年前

    是否尝试将垂直对齐:中间;css属性应用于表单元格?

    我相信默认的垂直对齐方式是top,所以应用上面的方法应该会覆盖它。另外,如果你能给我一个链接到一个例子页,显示这一点,我可以进一步研究。

        2
  •  3
  •   2Yootz    11 年前

    这将使其居中对齐。如果您有其他需要,请将其从中间改为顶部或底部。

    <style type="text/css">
    .ui-jqgrid tr.jqgrow td {vertical-align:middle !important}
    </style>
    
        3
  •  1
  •   Marcus Leon    14 年前

    我们的网格在另一个div中 vertical-align:top

        4
  •  1
  •   user1948613    12 年前
    <style>
        .ui-jqgrid tr.jqgrow { outline-style: none; color:#286abf;font-weight:normal; cursor : pointer; vertical-align:top }
    </style>